Skip site navigation (1) Skip section navigation (2)

Re: pgsql-server: Fire non-deferred AFTER triggers immediately

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)svr1(dot)postgresql(dot)org>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql-server: Fire non-deferred AFTER triggers immediately
Date: 2004-09-10 22:40:21
Message-ID: 200409102240.i8AMeLs23680@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-committers
TODO marked as done:
	
	* -Have AFTER triggers execute after the appropriate SQL statement in a
	  function, not at the end of the function


---------------------------------------------------------------------------

Tom Lane wrote:
> Log Message:
> -----------
> Fire non-deferred AFTER triggers immediately upon query completion,
> rather than when returning to the idle loop.  This makes no particular
> difference for interactively-issued queries, but it makes a big difference
> for queries issued within functions: trigger execution now occurs before
> the calling function is allowed to proceed.  This responds to numerous
> complaints about nonintuitive behavior of foreign key checking, such as
> http://archives.postgresql.org/pgsql-bugs/2004-09/msg00020.php, and
> appears to be required by the SQL99 spec.
> Also take the opportunity to simplify the data structures used for the
> pending-trigger list, rename them for more clarity, and squeeze out a
> bit of space.
> 
> Modified Files:
> --------------
>     pgsql-server/doc/src/sgml/ref:
>         set_constraints.sgml (r1.11 -> r1.12)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/doc/src/sgml/ref/set_constraints.sgml.diff?r1=1.11&r2=1.12)
>     pgsql-server/doc/src/sgml:
>         release.sgml (r1.294 -> r1.295)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/doc/src/sgml/release.sgml.diff?r1=1.294&r2=1.295)
>     pgsql-server/src/backend/access/transam:
>         xact.c (r1.186 -> r1.187)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/access/transam/xact.c.diff?r1=1.186&r2=1.187)
>     pgsql-server/src/backend/commands:
>         copy.c (r1.230 -> r1.231)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/commands/copy.c.diff?r1=1.230&r2=1.231)
>         explain.c (r1.124 -> r1.125)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/commands/explain.c.diff?r1=1.124&r2=1.125)
>         portalcmds.c (r1.33 -> r1.34)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/commands/portalcmds.c.diff?r1=1.33&r2=1.34)
>         trigger.c (r1.171 -> r1.172)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/commands/trigger.c.diff?r1=1.171&r2=1.172)
>     pgsql-server/src/backend/executor:
>         functions.c (r1.87 -> r1.88)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/executor/functions.c.diff?r1=1.87&r2=1.88)
>         spi.c (r1.125 -> r1.126)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/executor/spi.c.diff?r1=1.125&r2=1.126)
>     pgsql-server/src/backend/tcop:
>         postgres.c (r1.430 -> r1.431)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/tcop/postgres.c.diff?r1=1.430&r2=1.431)
>         pquery.c (r1.85 -> r1.86)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/tcop/pquery.c.diff?r1=1.85&r2=1.86)
>         utility.c (r1.228 -> r1.229)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/tcop/utility.c.diff?r1=1.228&r2=1.229)
>     pgsql-server/src/backend/utils/adt:
>         ri_triggers.c (r1.71 -> r1.72)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/utils/adt/ri_triggers.c.diff?r1=1.71&r2=1.72)
>     pgsql-server/src/include/commands:
>         trigger.h (r1.48 -> r1.49)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/commands/trigger.h.diff?r1=1.48&r2=1.49)
>     pgsql-server/src/test/regress/expected:
>         foreign_key.out (r1.36 -> r1.37)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/test/regress/expected/foreign_key.out.diff?r1=1.36&r2=1.37)
>         plpgsql.out (r1.19 -> r1.20)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/test/regress/expected/plpgsql.out.diff?r1=1.19&r2=1.20)
>     pgsql-server/src/test/regress/sql:
>         plpgsql.sql (r1.14 -> r1.15)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/test/regress/sql/plpgsql.sql.diff?r1=1.14&r2=1.15)
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-committers by date

Next:From: Tom LaneDate: 2004-09-10 22:52:25
Subject: Re: pgsql-server: Fix a number of places where brittle
Previous:From: Bruce MomjianDate: 2004-09-10 22:38:57
Subject: pgsql-server: Done: < * Have AFTER triggers execute after the

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group