Error in sample on doc page

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: postgresql(at)nowisit(dot)net
Subject: Error in sample on doc page
Date: 2021-11-15 05:52:21
Message-ID: 163695554137.11069.14314706306790865461@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/functions-event-triggers.html
Description:

https://www.postgresql.org/docs/13/functions-event-triggers.html

Two issues here:
1) The CREATE EVENT TRIGGER command in the sample code does not execute (see
output below)
2) When executed in an anonymous do block, there is no error. The CREATE
EVENT TRIGGER executed outside the do block should have given an error
saying already exists. Instead it gives the error: "ERROR: syntax error at
end of input".

ae_lake.cdc> do $docbug$
BEGIN
RAISE INFO 'Executing sample from PG docs:
https://www.postgresql.org/docs/13/functions-event-triggers.html...';

CREATE FUNCTION test_event_trigger_table_rewrite_oid()
RETURNS event_trigger
LANGUAGE plpgsql AS
$$
BEGIN
RAISE NOTICE 'rewriting table % for reason %',

pg_event_trigger_table_rewrite_oid()::regclass,
pg_event_trigger_table_rewrite_reason();
END;
$$;

CREATE EVENT TRIGGER test_table_rewrite_oid
ON table_rewrite
EXECUTE FUNCTION test_event_trigger_table_rewrite_oid();

END;
$docbug$
[2021-11-14 22:47:49] [00000] Executing sample from PG docs:
https://www.postgresql.org/docs/13/functions-event-triggers.html...
[2021-11-14 22:47:49] completed in 109 ms
ae_lake.cdc> CREATE EVENT TRIGGER test_table_rewrite_oid
ON table_rewrite
[2021-11-14 22:48:09] [42601] ERROR: syntax error at end of input
[2021-11-14 22:48:09] Position: 79

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Junk Mail 2021-11-15 10:27:18 Re: Error in sample on doc page
Previous Message Tom Lane 2021-11-14 18:13:39 Re: Why clear pg_wal when recovering?