Re: function error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jean-Yves F(dot) Barbier" <12ukwn(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: function error
Date: 2011-11-05 23:31:13
Message-ID: 18026.1320535873@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Jean-Yves F. Barbier" <12ukwn(at)gmail(dot)com> writes:
> I've made a small function but it is refused:

> CREATE FUNCTION get_user_oid(TEXT) -- 1- Owner's name
> RETURNS OID AS $$
> SELECT usesysid AS useroid FROM pg_user WHERE usename = $1;
> END;
> $$ LANGUAGE sql;

You don't want the END; there (that's plpgsql syntax not SQL).

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jean-Yves F. Barbier 2011-11-06 18:58:41 extension installation PB
Previous Message Jean-Yves F. Barbier 2011-11-05 23:19:52 function error