Why No WHERE clause for INSERT statements

Поиск
Список
Период
Сортировка
От Maurice Gittens
Тема Why No WHERE clause for INSERT statements
Дата
Msg-id AANLkTimKDDBjAp3FxL4Q=RhJf6LYhQ-ZKF1i=rvs0ark@mail.gmail.com
обсуждение исходный текст
Ответы Re: Why No WHERE clause for INSERT statements  (Michael Glaesemann <grzm@seespotcode.net>)
Re: Why No WHERE clause for INSERT statements  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Ray Stell
Дата:
Сообщение: Re: How to do hot backup using postgres
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: Why No WHERE clause for INSERT statements