pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: José Soares <jose@sferacarta.com>
To: Will Benton <bentonw@stolaf.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] aggregate functions and varchar type
Date: Mon, 12 Apr 1999 15:18:40 +0200
Message-ID: <3711F2AF.9A92633F@sferacarta.com> (raw)
References: <Pine.LNX.4.04.9904111812390.20971-100000@woggo.dhs.org>

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




view thread (2+ messages)

Message-ID: <3711F2AF.9A92633F@sferacarta.com>
Permalink:  ../3711F2AF.9A92633F@sferacarta.com/
Also on:    postgresql.org/message-id/3711F2AF.9A92633F@sferacarta.com

 · 

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: jose@sferacarta.com, bentonw@stolaf.edu
  Subject: Re: [SQL] aggregate functions and varchar type
  In-Reply-To: <3711F2AF.9A92633F@sferacarta.com>
  References: <Pine.LNX.4.04.9904111812390.20971-100000@woggo.dhs.org> <3711F2AF.9A92633F@sferacarta.com>

* 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