Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group