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 | CAEZATCW2BPV8H_FoAj6V-_4aK3zn2+DX0pUSL76aXzqYUQsoWQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values (Alexander Lakhin <exclusion@gmail.com>) |
Ответы |
Re: BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values
|
Список | pgsql-bugs |
On Thu, 23 Feb 2023 at 11:00, Alexander Lakhin <exclusion@gmail.com> wrote: > > Please look at another anomaly, probably not related to the initial one, > but related to INSERT VALUES(...), (...), as I can see: > 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 * FROM (SELECT a FROM t WHERE NEW.a = t.a) tt; > > INSERT INTO v VALUES (1), (2); [I just pushed the other fix] This is definitely an independent bug, nothing to do with DEFAULTs, and also not specific to multi-row VALUES lists either, since it also fails with INSERT INTO v SELECT 1. Apparently the rewriter is generating a query that the planner is not able to handle, though I'm not clear on the precise details. As another clue, if the rule query is modified to prevent subquery pullup, by adding OFFSET 0, it fails in a different way, with ERROR: plan should not reference subplan's variable in finalize_plan(). Not sure if that helps find the problem. Regards, Dean
В списке pgsql-bugs по дате отправления: