pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sergey kapustin <kapustin.sergey@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Helper aggregate function
Date: Sun, 3 Feb 2008 13:44:04 +0200
Message-ID: <cf82f1380802030344x10138291ob685533ef4b5a4c8@mail.gmail.com> (raw)

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!

view thread (3+ messages)  latest in thread

Message-ID: <cf82f1380802030344x10138291ob685533ef4b5a4c8@mail.gmail.com>
Permalink:  ../cf82f1380802030344x10138291ob685533ef4b5a4c8@mail.gmail.com/
Also on:    postgresql.org/message-id/cf82f1380802030344x10138291ob685533ef4b5a4c8@mail.gmail.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: kapustin.sergey@gmail.com
  Subject: Re: Helper aggregate function
  In-Reply-To: <cf82f1380802030344x10138291ob685533ef4b5a4c8@mail.gmail.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