Search Postgresql Archives

Why No WHERE clause for INSERT statements

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

 



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

-- 
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