error with "select from tg_relname"

From: Sebastien Caille <sebastien(dot)caille(at)epfl(dot)ch>
To: pgsql-general(at)postgresql(dot)org
Subject: error with "select from tg_relname"
Date: 2001-11-07 14:43:36
Message-ID: 3BE94898.4F06BA85@epfl.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I'm trying to write a generic function for some triggers (full code @
end of mail)
It works fine with

"select uid into same_login
from USR
where login = new.login;"

but when I try to do something like

"select uid into same_login
from TG_RELNAME
where login = new.login;",

the function die with " ERROR: parser: parse error at or near "$1" "

Did I miss something ?
(egh... I hope so... :) )

tia
(please CC me since I'm not on the list)

--

drop function uniq_login();
drop trigger check_uniq_login on usr;

create function uniq_login ()
returns opaque as '
declare
same_login integer;
tab varchar;
begin

select uid into same_login
from tg_relname
where login = new.login;

if same_login notnull then
raise exception ''Login already used'';
end if;

return new;
end;
' language 'plpgsql';

create trigger check_uniq_login
before insert or update
on usr for each row
execute procedure uniq_login();

Browse pgsql-general by date

  From Date Subject
Next Message Bryan White 2001-11-07 14:59:00 Re: a query ...
Previous Message Javier Dussaillant 2001-11-07 14:32:06 Old Template0 is annoying me!