error with "select from tg_relname"

Поиск
Список
Период
Сортировка
От Sebastien Caille
Тема error with "select from tg_relname"
Дата
Msg-id 3BE94898.4F06BA85@epfl.ch
обсуждение исходный текст
Список 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();

В списке pgsql-general по дате отправления:

Предыдущее
От: "Richard Teviotdale"
Дата:
Сообщение: Re: OID's as Primary Keys
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_dump usage - problems with restore due to the use of tab delimiters