AW: [SQL] Problems with RULE

2001-03-07 Thread Jens Hartwig
> [...] > So - if you issue "DELETE FROM t_xyz" you'd want two things to happen: > > 1. where deleted is false set it to true > 2. where deleted was true delete the record > > So - PG rewrites the query into two parts: > > DELETE FROM t_xyz WHERE old.deleted=false > DELETE FROM t_xyz WHERE NOT(old

Re: AW: [SQL] Problems with RULE

2001-03-07 Thread Tom Lane
"Jens Hartwig" <[EMAIL PROTECTED]> writes: > What would have happened, if I executed an unconditional DELETE? > => DELETE FROM t_xyz; > Which statement would have been generated by PostgreSQL in this case? Unfortunately, I didn't keep the prior discussion, so I don't remember exactly what the r

Re: [SQL] Problems with RULE

2001-03-07 Thread Richard Huxton
From: "Jens Hartwig" <[EMAIL PROTECTED]> > Hello Richard, > > this was a very precise analysis - thanks for the effort you made! Precisely wrong in this case. My mistakes have some of the finest tolerances in the world. 8-) > Nevertheless the Tom's explanation of the behaviour in case of views

AW: [SQL] Problems with RULE

2001-03-06 Thread Jens Hartwig
tp://www.t-systems.de > -Ursprüngliche Nachricht- > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Gesendet: Dienstag, 6. März 2001 19:10 > An: Jens Hartwig > Cc: PSQL-Sql (E-Mail) > Betreff: Re: [SQL] Problems with RULE > > > On 3/6/01, 7:11:48 AM, Jens Hartwig

AW: [SQL] Problems with RULE

2001-03-06 Thread Jens Hartwig
JH: > > [...] > > I tried to implement the following rule: if someone wants to delete a record > > from a table t_xyz (id integer, deleted boolean) the record should get a > > delete-flag (deleted = true). When this "pre-deleted" record is deleted for > > the next time it should be physically dele

Re: [SQL] Problems with RULE

2001-03-06 Thread Tom Lane
"Jens Hartwig" <[EMAIL PROTECTED]> writes: > I tried to implement the following rule: if someone wants to delete a record > from a table t_xyz (id integer, deleted boolean) the record should get a > delete-flag (deleted = true). When this "pre-deleted" record is deleted for > the next time it shou

Re: [SQL] Problems with RULE

2001-03-06 Thread dev
On 3/6/01, 7:11:48 AM, Jens Hartwig <[EMAIL PROTECTED]> wrote regarding [SQL] Problems with RULE: > Hello all, > I tried to implement the following rule: if someone wants to delete a record > from a table t_xyz (id integer, deleted boolean) the record should get a > de

Re: [SQL] Problems with RULE

2001-03-06 Thread dev
On 3/6/01, 7:11:48 AM, Jens Hartwig <[EMAIL PROTECTED]> wrote regarding [SQL] Problems with RULE: > Hello all, > I tried to implement the following rule: if someone wants to delete a record > from a table t_xyz (id integer, deleted boolean) the record should get a > de

[SQL] Problems with RULE

2001-03-06 Thread Jens Hartwig
Hello all, I tried to implement the following rule: if someone wants to delete a record from a table t_xyz (id integer, deleted boolean) the record should get a delete-flag (deleted = true). When this "pre-deleted" record is deleted for the next time it should be physically deleted from the datab