pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
aggregate functions and varchar type
2+ messages / 2 participants
[nested] [flat]

* aggregate functions and varchar type
@ 1999-04-11 23:30 Will Benton <bentonw@stolaf.edu>
  1999-04-12 13:18 ` Re: [SQL] aggregate functions and varchar type José Soares <jose@sferacarta.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Will Benton @ 1999-04-11 23:30 UTC (permalink / raw)
  To: pgsql-sql

I am having trouble with the following aggregate function (in postgres
6.4.2):

create aggregate nlappend (
  basetype = varchar,
  sfunc1 = nl_strappend,
  stype1 = varchar,
  initcond1 = ''
);

When I try to define it, I get "parse error at or near varchar".
(nl_strappend is a function of two varchar arguments that returns a
varchar).  Defining an aggregate function on other types works fine.  

Is it possible to define an aggregate function on the varchar type?  If
so, what am I doing wrong?

Please reply via private email; I will summarize replies and followup to
the list.




thanks,
wb

---
Will Benton        | "A black eye never reformed a drunkard; a czar never 
bentonw@stolaf.edu |  stopped a free thought"              --Charles Ives




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [SQL] aggregate functions and varchar type
  1999-04-11 23:30 aggregate functions and varchar type Will Benton <bentonw@stolaf.edu>
@ 1999-04-12 13:18 ` José Soares <jose@sferacarta.com>
  0 siblings, 0 replies; 2+ messages in thread

From: José Soares @ 1999-04-12 13:18 UTC (permalink / raw)
  To: Will Benton <bentonw@stolaf.edu>; +Cc: pgsql-sql

The parser has some difficulties with "varchar" word.
If you are using v6.4.?
You can define your function as:

create aggregate nlappend (
  basetype = text,
  sfunc1 = nl_strappend,
  stype1 = text,
  initcond1 = ''
);

and then define  nl_strappend(text,text)
and now you can pass varchar, char or text as paramters because
PostgreSQL automatically converts it to text.

José


Will Benton ha scritto:

> I am having trouble with the following aggregate function (in postgres
> 6.4.2):
>
> create aggregate nlappend (
>   basetype = varchar,
>   sfunc1 = nl_strappend,
>   stype1 = varchar,
>   initcond1 = ''
> );
>
> When I try to define it, I get "parse error at or near varchar".
> (nl_strappend is a function of two varchar arguments that returns a
> varchar).  Defining an aggregate function on other types works fine.
>
> Is it possible to define an aggregate function on the varchar type?  If
> so, what am I doing wrong?
>
> Please reply via private email; I will summarize replies and followup to
> the list.
>
> thanks,
> wb
>
> ---
> Will Benton        | "A black eye never reformed a drunkard; a czar never
> bentonw@stolaf.edu |  stopped a free thought"              --Charles Ives




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-04-12 13:18 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-04-11 23:30 aggregate functions and varchar type Will Benton <bentonw@stolaf.edu>
1999-04-12 13:18 ` José Soares <jose@sferacarta.com>

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