Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y9jnI-0002wV-Uy for pgsql-committers@arkaria.postgresql.org; Sat, 10 Jan 2015 00:20:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y9jnI-0006NL-EC for pgsql-committers@arkaria.postgresql.org; Sat, 10 Jan 2015 00:20:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y9jnH-0006Ks-GE for pgsql-committers@postgresql.org; Sat, 10 Jan 2015 00:20:43 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Y9jnD-00024D-Ph; Sat, 10 Jan 2015 00:20:42 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1Y9jnB-0003l4-Lq; Fri, 09 Jan 2015 19:20:37 -0500 Date: Fri, 9 Jan 2015 19:20:37 -0500 From: Bruce Momjian To: Jeff Davis Cc: Kevin Grittner , pgsql-committers@postgresql.org Subject: Re: pgsql: Fix documentation template for CREATE TRIGGER. Message-ID: <20150110002037.GF26812@momjian.us> References: <1403464789.9081.11.camel@jeff-desktop> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="mJm6k4Vb/yFcL9ZU" Content-Disposition: inline In-Reply-To: <1403464789.9081.11.camel@jeff-desktop> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org --mJm6k4Vb/yFcL9ZU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jun 22, 2014 at 12:19:49PM -0700, Jeff Davis wrote: > On Sat, 2014-06-21 at 14:21 +0000, Kevin Grittner wrote: > > Fix documentation template for CREATE TRIGGER. > > > > By using curly braces, the template had specified that one of > > "NOT DEFERRABLE", "INITIALLY IMMEDIATE", or "INITIALLY DEFERRED" > > was required on any CREATE TRIGGER statement, which is not > > accurate. Change to square brackets makes that optional. > > > > Backpatch to 9.1, where the error was introduced. > > It still doesn't look quite right to me. The new form: > > [ NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY > DEFERRED } ] > > says that, if DEFERRABLE is specified, then INITIALLY IMMEDIATE or > INITIALLY DEFERRED is required. But the following is accepted by the > server: > > create constraint trigger mytrigger > after insert on dummy_table deferrable > for each row execute procedure dummy_trigger(); > > (Although the standard doesn't seem to have deferrable triggers, that > does seem to match the deferrable constraint syntax that is in the > spec.) > > For that matter, the following is also accepted by the server: > > create constraint trigger mytrigger > after insert on dummy_table initially deferred deferrable > for each row execute procedure dummy_trigger(); > > That case may be a bug; and regardless I don't think we want to > document/encourage specifying them in that order. But the first case > seems reasonable to me. I agree with both statements so I have applied the attached doc patch to head. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + --mJm6k4Vb/yFcL9ZU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="trigger.diff" diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml new file mode 100644 index 29b815c..aae0b41 *** a/doc/src/sgml/ref/create_trigger.sgml --- b/doc/src/sgml/ref/create_trigger.sgml *************** PostgreSQL documentation *** 24,30 **** CREATE [ CONSTRAINT ] TRIGGER name { BEFORE | AFTER | INSTEAD OF } { event [ OR ... ] } ON table_name [ FROM referenced_table_name ] ! [ NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } ] [ FOR [ EACH ] { ROW | STATEMENT } ] [ WHEN ( condition ) ] EXECUTE PROCEDURE function_name ( arguments ) --- 24,30 ---- CREATE [ CONSTRAINT ] TRIGGER name { BEFORE | AFTER | INSTEAD OF } { event [ OR ... ] } ON table_name [ FROM referenced_table_name ] ! [ NOT DEFERRABLE | [ DEFERRABLE ] [ INITIALLY IMMEDIATE | INITIALLY DEFERRED ] ] [ FOR [ EACH ] { ROW | STATEMENT } ] [ WHEN ( condition ) ] EXECUTE PROCEDURE function_name ( arguments ) --mJm6k4Vb/yFcL9ZU Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers --mJm6k4Vb/yFcL9ZU--