Re: BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values
Дата
Msg-id CAEZATCUQtGx6gQtryMbC3ZsEd4GUcc5THVnkXP1F0Fan_uLG-Q@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values
Список pgsql-bugs
On Tue, 21 Feb 2023 at 09:21, PG Bug reporting form
<noreply@postgresql.org> wrote:
>
> The following queries:
> CREATE TABLE t (a int, b int DEFAULT -1);
> CREATE VIEW v AS SELECT * FROM t;
> CREATE RULE vr AS ON INSERT TO v DO ALSO INSERT INTO t SELECT 1;
> INSERT INTO v VALUES (0, DEFAULT), (1, DEFAULT);
>
> lead to an assert for me:
>

Nice catch.

It looks like we need something like the attached, to deal with
product queries that are INSERT ... SELECT queries. In that case the
VALUES RTE will be at the same index, but in the SELECT part of the
product query, not the top-level product query itself.

Annoyingly, this can't use getInsertSelectQuery(), because the product
query will no longer have the OLD and NEW placeholder entries, so I
have just duplicated the relevant portions of its code, rather than
remove those checks from getInsertSelectQuery().

Regards,
Dean

Вложения

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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values
Следующее
От: Duncan Sands
Дата:
Сообщение: Unlimited memory consumption with long-lived connection