Received: from avenger.alex-ua.com (alex-gu.gu.net [194.93.170.197]) by hub.org (8.9.3/8.9.3) with ESMTP id NAA24914 for ; Sun, 11 Jul 1999 13:36:34 -0400 (EDT) (envelope-from qd@sea.com.ua) From: qd@sea.com.ua Received: from zamarayev.localdomain (sea.alex-ua.com [195.123.19.32]) by avenger.alex-ua.com (8.8.8/8.8.8) with ESMTP id UAA15458 for ; Sun, 11 Jul 1999 20:36:21 +0300 (EEST) (envelope-from qd@sea.com.ua) Received: (from qd@localhost) by zamarayev.localdomain (8.9.3/8.9.2) id UAA00468 for pgsql-sql@postgresql.org; Sun, 11 Jul 1999 20:43:03 GMT (envelope-from qd) Date: Sun, 11 Jul 1999 20:43:03 GMT Message-Id: <199907112043.UAA00468@zamarayev.localdomain> To: pgsql-sql@postgresql.org Subject: Aggregates 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 ?