From: | "Robins Tharakan" <tharakan(at)gmail(dot)com> |
---|---|
To: | "sergey kapustin" <kapustin(dot)sergey(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Helper aggregate function |
Date: | 2008-02-03 18:58:00 |
Message-ID: | 36af4bed0802031058j4ce4be26p111d0071bf31d5a0@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Please correct me if I am wrong, but as the last few lines of the first
section in the given document says, you can use $n only for values and not
for identifiers.
http://www.postgresql.org/docs/8.3/static/xfunc-sql.html
And one more thing, may be you would want to use a user-defined return type
instead of void for this function.
*Robins*
On Feb 3, 2008 5:14 PM, sergey kapustin <kapustin(dot)sergey(at)gmail(dot)com> wrote:
> Hello!
> Can anyone tell me how i do this properly?
>
> create or replace function agg(varchar,varchar) returns void as $func$
> select $1,count(*) from $2 group by $1 order by $1;
> $func$
> Language SQL;
>
> Right now this wives me "ERROR: syntax error at or near "$2" at character
> 97
> select $1,count(*) from $2 group by $1 order by $1;"
>
> Thank you!
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Christian Kindler | 2008-02-03 20:07:05 | Re: Helper aggregate function |
Previous Message | sergey kapustin | 2008-02-03 11:44:04 | Helper aggregate function |