pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: qd@sea.com.ua
To: pgsql-sql@postgresql.org
Subject: Aggregates
Date: Sun, 11 Jul 1999 20:43:03 GMT
Message-ID: <199907112043.UAA00468@zamarayev.localdomain> (raw)


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 ?






view thread (2+ messages)

Message-ID: <199907112043.UAA00468@zamarayev.localdomain>
Permalink:  ../199907112043.UAA00468@zamarayev.localdomain/
Also on:    postgresql.org/message-id/199907112043.UAA00468@zamarayev.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: qd@sea.com.ua
  Subject: Re: Aggregates
  In-Reply-To: <199907112043.UAA00468@zamarayev.localdomain>
  References: <199907112043.UAA00468@zamarayev.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox