Search Postgresql Archives

DELETE Weirdness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are two ways of deleting things,

DELETE FROM <table> WHERE PK IN ( ...SET... );

DELETE FROM <table> USING <table2>
WHERE <join condition> AND <filter clause>;

I am deleting from a table where the rows are inter-related (it is a
tree); using the first version with IN, it does not delete all rows;
there is a trigger that rearranges the rows when a row is deleted
(updating references etc.).  Disabling this trigger results in correct
behavoir.

However, using the second version (using USING) works as expected with
or without disabling the said triggers.

I cannot quite understand this; Are the contents of the IN query
worked out ONCE per outer query and therefore become invalid when
DELETE comes along and changes items that were part of the set ? (for
e.g.)



-ravi

-- 
:wq

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux