Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qZ6dG-0042Nw-NN for pgsql-docs@arkaria.postgresql.org; Thu, 24 Aug 2023 09:28:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qZ6dF-006tl0-Jo for pgsql-docs@arkaria.postgresql.org; Thu, 24 Aug 2023 09:28:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qZ6dF-006tki-8m for pgsql-docs@lists.postgresql.org; Thu, 24 Aug 2023 09:28:01 +0000 Received: from mout-u-204.mailbox.org ([80.241.59.204]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qZ6dB-000gYi-S1 for pgsql-docs@lists.postgresql.org; Thu, 24 Aug 2023 09:27:59 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4RWd6H6M5lz9sQK; Thu, 24 Aug 2023 11:27:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1692869272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SUbMxE1q0S1uGiKJHfOGhzhliTCF1A6qZdhuOdfpzhA=; b=HdhGXwwU4KDC/U+RLDMIHjjKsax74fizdtugepOx2uf6n7/sox/zb3nqk+vhEmF/6VlbrC Qpbl3RaBu36s01typJx/UDy1vIlp4Ie+DR56Gb51OAhTtI3aDJ1u1HEiJerWMNvHHoe6q0 E/3k9XLwvXrEM7lQvy+hMvbK9f48xHzdmK1S7sZyyJbgpqyDipchezfGyRs6oOhzbs3TLh rkv8mcLRC3xTcpZEUZor5dOSeiQBM2rVupP0kC8std2bOlMTAEM/eu54D7Y+0zBOgH8M0H T4PKYSmNHZxReLQ0dB6ysPBRin1ZXfB7htip6TU3Hr8r5c2ROikejDb3p//5Ew== Date: Thu, 24 Aug 2023 11:27:46 +0200 (CEST) From: Erik Wienhold To: at@mtc.md, pgsql-docs@lists.postgresql.org Message-ID: <890483629.390853.1692869266420@office.mailbox.org> In-Reply-To: <169286345424.621.8832808856493079834@wrigleys.postgresql.org> References: <169286345424.621.8832808856493079834@wrigleys.postgresql.org> Subject: Re: CREATE TRIGGER documentation inconsistensies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: 4RWd6H6M5lz9sQK List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 24/08/2023 09:50 CEST PG Doc comments form 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