Re: [SQL] aggregate functions and varchar type

From: José Soares <jose(at)sferacarta(dot)com>
To: Will Benton <bentonw(at)stolaf(dot)edu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] aggregate functions and varchar type
Date: 1999-04-12 13:18:40
Message-ID: 3711F2AF.9A92633F@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)stolaf(dot)edu | stopped a free thought" --Charles Ives

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Walt Bigelow 1999-04-12 18:58:52 subqueries
Previous Message Will Benton 1999-04-11 23:30:58 aggregate functions and varchar type