Hi,
the postgresql 8.4 documentation defines the syntax of the DELETE statement as:
DELETE FROM [ ONLY ] table [ [ AS ] alias ]
[ USING usinglist ]
[ WHERE condition | WHERE CURRENT OF cursor_name ]
[ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
The syntax includes a where clause allowing qualified declarative
control over what is deleted.
Why would the same not hold for the insert statement?
More specifically; the INSERT statement is currently defined as:
INSERT INTO table [ ( column [, ...] ) ]
{ DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [,
...] | query }
[ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
Does not symmetry dictate that the definition of the INSERT statement
be similar to:
INSERT INTO table [ ( column [, ...] ) ]
[ USING usinglist ]
[ WHERE condition | WHERE CURRENT OF cursor_name ]
{ DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [,
...] | query }
[ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
This syntax would allow tuples to be inserted only when some condition is true.
What I am missing?
Cheers,
Maurice