Re: Acessing columns of parent tables with PL/pgSQL

Поиск
Список
Период
Сортировка
От Darko Prenosil
Тема Re: Acessing columns of parent tables with PL/pgSQL
Дата
Msg-id 200206281917.17144.darko.prenosil@finteh.hr
обсуждение исходный текст
Ответ на Acessing columns of parent tables with PL/pgSQL  (Hans-Juergen Schoenig <hs@cybertec.at>)
Список pgsql-general
On Thursday 27 June 2002 15:38, Hans-Juergen Schoenig wrote:
> I wonder if there is a way to access columns in a parent table when
> running a PL/pgSQL trigger.
>
> Here is an example:
>
>
> CREATE TABLE a (
>          one     text
> );
>
> CREATE TABLE b (
>          two     text
> ) INHERITS (a);
>
> CREATE FUNCTION myinsert() RETURNS opaque AS '
>          BEGIN
>                  RAISE NOTICE ''1 - NEW: %\n'', NEW.one;
>                  RAISE NOTICE ''2 - NEW: %\n'', NEW.two;
>                  RETURN NEW;
>          END;
> ' LANGUAGE 'plpgsql';
>
> CREATE TRIGGER mytrig BEFORE INSERT ON b
>           FOR EACH ROW EXECUTE PROCEDURE myinsert();
>
> INSERT INTO b VALUES ('a1', 'b2');
>
>
> An error is displayed:
>
>
> CREATE
> CREATE
> ERROR:  function myinsert already exists with same argument types

Create function fails, you have function with same name and arguments !






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

Предыдущее
От: Varun Kacholia
Дата:
Сообщение: Re: DbVisualizer 2.1 exeptions
Следующее
От: Thomas Beutin
Дата:
Сообщение: Re: One source of constant annoyance identified