From: | qd(at)sea(dot)com(dot)ua |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Aggregates |
Date: | 1999-07-11 20:43:03 |
Message-ID: | 199907112043.UAA00468@zamarayev.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi, All !
PostgreSQL-6.4 lacks min/max functions for character types.
As I needed one I did the following:
create function max_str(bpchar, bpchar) returns bpchar as
'select $1 where bpchargt($1, $2) union select $2 where
bpcharge($2, $1)';
This function seems to work fine for 'char(20)'.
Next, I define the aggregate:
create aggregate smax (basetype=bpchar, sfunc1=max_str, stype1=bpchar,
initcond1='');
and I have a table with a column 'magic char(20)'
When I try to use my smax I get such an error:
select smax(magic) from my_table;
ERROR: bpcharin: the length of char() must be less than 4096.
I have no char type with such length. I checked if my
function max_str returns a correct length:
select length(max_str('aab' 'ab'));
It returns 2 as it should be.
So where is the bug ?
From | Date | Subject | |
---|---|---|---|
Next Message | Philip Warner | 1999-07-12 02:36:24 | Re: [HACKERS] accumulated statistics |
Previous Message | Oleg Bartunov | 1999-07-11 17:46:04 | accumulated statistics |