Re: "RETURNING PRIMARY KEY" syntax extension

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: "RETURNING PRIMARY KEY" syntax extension
Дата
Msg-id 28583.1402325169@sss.pgh.pa.us
обсуждение исходный текст
Ответ на "RETURNING PRIMARY KEY" syntax extension  (Ian Barwick <ian@2ndquadrant.com>)
Список pgsql-hackers
Ian Barwick <ian@2ndquadrant.com> writes:
> [ RETURNING PRIMARY KEY ]

It looks to me like this is coded to have the expansion of the "primary
key" done at parse time, which seems like fundamentally the wrong thing.
Consider a view or rule containing this clause; the pkey might be
different by the time execution rolls around.  It'd be better probably
if the rewriter or planner did the expansion (and threw the error for
no-primary-key, if necessary).

Alternatively, we could do it like this and consider that the view is
dependent on the primary key constraint, but that seems inflexible.

BTW, it seems like your representation of the clause was rather poorly
chosen: it forces changing a whole lot of code that otherwise would
not need to be changed.  I'd have left returningList alone and put the
returningPrimaryKey flag someplace else.
        regards, tom lane



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Inaccuracy in VACUUM's tuple count estimates
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: NUMA packaging and patch