agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Fix UPDATE/DELETE ... WHERE CURRENT OF on a table with virtual c 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix UPDATE/DELETE ... WHERE CURRENT OF on a table with virtual c @ 2026-04-22 10:54 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 2+ messages in thread From: Dean Rasheed @ 2026-04-22 10:54 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix UPDATE/DELETE ... WHERE CURRENT OF on a table with virtual columns. Formerly, attempting to use WHERE CURRENT OF to update or delete from a table with virtual generated columns would fail with the error "WHERE CURRENT OF on a view is not implemented". The reason was that the check preventing WHERE CURRENT OF from being used on a view was in replace_rte_variables_mutator(), which presumed that the only way it could get there was as part of rewriting a query on a view. That is no longer the case, since replace_rte_variables() is now also used to expand the virtual generated columns of a table. Fix by doing the check for WHERE CURRENT OF on a view at parse time. This is safe, since it is no longer possible for the relkind to change after the query is parsed (as of b23cd185f). Reported-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com> Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com> Author: Dean Rasheed <dean.a.rasheed@gmail.com> Discussion: https://postgr.es/m/CAHg+QDc_TwzSgb=B_QgNLt3mvZdmRK23rLb+RkanSQkDF40GjA@mail.gmail.com Backpatch-through: 18 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/5548a969b65d4e0d5045d9db0bcac062a9a3e3c7 Modified Files -------------- src/backend/parser/analyze.c | 16 +++++++++++++ src/backend/rewrite/rewriteManip.c | 19 ---------------- src/test/regress/expected/generated_virtual.out | 30 +++++++++++++++++++++++++ src/test/regress/expected/portals.out | 11 +++++++++ src/test/regress/sql/generated_virtual.sql | 15 +++++++++++++ src/test/regress/sql/portals.sql | 5 +++++ 6 files changed, 77 insertions(+), 19 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix UPDATE/DELETE ... WHERE CURRENT OF on a table with virtual c @ 2026-04-22 10:54 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 2+ messages in thread From: Dean Rasheed @ 2026-04-22 10:54 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix UPDATE/DELETE ... WHERE CURRENT OF on a table with virtual columns. Formerly, attempting to use WHERE CURRENT OF to update or delete from a table with virtual generated columns would fail with the error "WHERE CURRENT OF on a view is not implemented". The reason was that the check preventing WHERE CURRENT OF from being used on a view was in replace_rte_variables_mutator(), which presumed that the only way it could get there was as part of rewriting a query on a view. That is no longer the case, since replace_rte_variables() is now also used to expand the virtual generated columns of a table. Fix by doing the check for WHERE CURRENT OF on a view at parse time. This is safe, since it is no longer possible for the relkind to change after the query is parsed (as of b23cd185f). Reported-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com> Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com> Author: Dean Rasheed <dean.a.rasheed@gmail.com> Discussion: https://postgr.es/m/CAHg+QDc_TwzSgb=B_QgNLt3mvZdmRK23rLb+RkanSQkDF40GjA@mail.gmail.com Backpatch-through: 18 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f3d03fbd5d017c8e8e42a3b3bcca696cfd94a8c3 Modified Files -------------- src/backend/parser/analyze.c | 16 +++++++++++++ src/backend/rewrite/rewriteManip.c | 19 ---------------- src/test/regress/expected/generated_virtual.out | 30 +++++++++++++++++++++++++ src/test/regress/expected/portals.out | 11 +++++++++ src/test/regress/sql/generated_virtual.sql | 15 +++++++++++++ src/test/regress/sql/portals.sql | 5 +++++ 6 files changed, 77 insertions(+), 19 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-04-22 10:54 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-04-22 10:54 pgsql: Fix UPDATE/DELETE ... WHERE CURRENT OF on a table with virtual c Dean Rasheed <dean.a.rasheed@gmail.com> 2026-04-22 10:54 pgsql: Fix UPDATE/DELETE ... WHERE CURRENT OF on a table with virtual c Dean Rasheed <dean.a.rasheed@gmail.com>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox