Re: CREATE TRIGGER documentation inconsistensies

Поиск
Список
Период
Сортировка
От Erik Wienhold
Тема Re: CREATE TRIGGER documentation inconsistensies
Дата
Msg-id 890483629.390853.1692869266420@office.mailbox.org
обсуждение исходный текст
Ответ на CREATE TRIGGER documentation inconsistensies  (PG Doc comments form <noreply@postgresql.org>)
Ответы Re: CREATE TRIGGER documentation inconsistensies
Список pgsql-docs
> On 24/08/2023 09:50 CEST PG Doc comments form <noreply@postgresql.org> wrote:
>
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/14/sql-createtrigger.html
> Description:
>
> In PostgreSQL 14 and 15 (previous versions I've not checked) is stated that
> CREATE TRIGGER statement is as follows:
>
> CREATE [OR REPLACE] [CONSTRAINT] TRIGGER
>
> however while CREATE TRIGGER works correctly the CREATE OR REPLACE TRIGGER
> construction leads to
>
> SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near "TRIGGER"
>
> looks like CREATE TRIGGER doesn't support OR REPLACE, but documentation is
> then incorrect.

Works for me on 14.9 and 15.4:

    BEGIN;
    CREATE TABLE mytbl (f1 int);
    CREATE FUNCTION mytrigger()
      RETURNS trigger
      LANGUAGE plpgsql
      AS $$ BEGIN RETURN null; END $$;
    CREATE OR REPLACE TRIGGER mytrig
      BEFORE INSERT
      ON mytbl
      EXECUTE FUNCTION mytrigger();
    COMMIT;

CREATE OR REPLACE TRIGGER was added in 14.  Did you test on an older version?

--
Erik



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

Предыдущее
От: PG Doc comments form
Дата:
Сообщение: CREATE TRIGGER documentation inconsistensies
Следующее
От: Andrei Tihonovschi
Дата:
Сообщение: Re: CREATE TRIGGER documentation inconsistensies