The following bug has been logged online:
Bug reference: 1952
Logged by: incheol yang
Email address: zoar@paran.com
PostgreSQL version: 8.0.3, 8.0.4
Operating system: linux
Description: Doc 32.4 example
Details:
You said like this
=> DELETE FROM ttest;
INFO: trigf (fired before): there are 2 rows in ttest
INFO: trigf (fired after ): there are 1 rows in ttest
INFO: trigf (fired before): there are 1 rows in ttest
INFO: trigf (fired after ): there are 0 rows in ttest
^^^^^^
remember what we said about visibility.
DELETE 2
but I got different output.
vela=# delete from ttest;
ì ë³´: trigf (fired before): there are 2 rows in ttest
ì ë³´: trigf (fired before): there are 1 rows in ttest
ì ë³´: trigf (fired after ): there are 0 rows in ttest
ì ë³´: trigf (fired after ): there are 0 rows in ttest
DELETE 2
Is this my mistake?
#####################################################
This is my entire list
vela=# \i MakeTrigger.sql
DROP TABLE
DROP FUNCTION
CREATE TABLE
CREATE FUNCTION
CREATE TRIGGER
CREATE TRIGGER
vela=# insert into ttest values (null);
ì ë³´: trigf (fired before): there are 0 rows in ttest
INSERT 0 0
vela=# insert into ttest values (1);
ì ë³´: trigf (fired before): there are 0 rows in ttest
ì ë³´: trigf (fired after ): there are 1 rows in ttest
INSERT 117771 1
vela=# insert into ttest select x *2 from ttest;
ì ë³´: trigf (fired before): there are 1 rows in ttest
ì ë³´: trigf (fired after ): there are 2 rows in ttest
INSERT 117772 1
vela=# update ttest set x = null where x = 2;
ì ë³´: trigf (fired before): there are 2 rows in ttest
UPDATE 0
vela=# update ttest set x = 4 where x = 2;
ì ë³´: trigf (fired before): there are 2 rows in ttest
ì ë³´: trigf (fired after ): there are 2 rows in ttest
UPDATE 1
vela=# delete from ttest;
ì ë³´: trigf (fired before): there are 2 rows in ttest
ì ë³´: trigf (fired before): there are 1 rows in ttest
ì ë³´: trigf (fired after ): there are 0 rows in ttest
ì ë³´: trigf (fired after ): there are 0 rows in ttest
DELETE 2
vela=#