pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on
@ 2018-03-17 19:00 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2018-03-17 19:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix WHERE CURRENT OF when the referenced cursor uses an index-only scan.

"UPDATE/DELETE WHERE CURRENT OF cursor_name" failed, with an error message
like "cannot extract system attribute from virtual tuple", if the cursor
was using a index-only scan for the target table.  Fix it by digging the
current TID out of the indexscan state.

It seems likely that the same failure could occur for CustomScan plans
and perhaps some FDW plan types, so that leaving this to be treated as an
internal error with an obscure message isn't as good an idea as it first
seemed.  Hence, add a bit of heaptuple.c infrastructure to let us deliver
a more on-topic message.  I chose to make the message match what you get
for the case where execCurrentOf can't identify the target scan node at
all, "cursor "foo" is not a simply updatable scan of table "bar"".
Perhaps it should be different, but we can always adjust that later.

In the future, it might be nice to provide hooks that would let custom
scan providers and/or FDWs deal with this in other ways; but that's
not a suitable topic for a back-patchable bug fix.

It's been like this all along, so back-patch to all supported branches.

Yugo Nagata and Tom Lane

Discussion: https://postgr.es/m/20180201013349.937dfc5f.nagata@sraoss.co.jp

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8f5ac440430ab1d4b0309a76df278caa87018beb

Modified Files
--------------
src/backend/access/common/heaptuple.c | 26 ++++++++++++
src/backend/executor/execCurrent.c    | 79 ++++++++++++++++++++++++++---------
src/include/executor/tuptable.h       |  2 +
src/test/regress/expected/portals.out | 24 +++++++++++
src/test/regress/sql/portals.sql      | 10 +++++
5 files changed, 121 insertions(+), 20 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on
@ 2018-03-17 19:00 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2018-03-17 19:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix WHERE CURRENT OF when the referenced cursor uses an index-only scan.

"UPDATE/DELETE WHERE CURRENT OF cursor_name" failed, with an error message
like "cannot extract system attribute from virtual tuple", if the cursor
was using a index-only scan for the target table.  Fix it by digging the
current TID out of the indexscan state.

It seems likely that the same failure could occur for CustomScan plans
and perhaps some FDW plan types, so that leaving this to be treated as an
internal error with an obscure message isn't as good an idea as it first
seemed.  Hence, add a bit of heaptuple.c infrastructure to let us deliver
a more on-topic message.  I chose to make the message match what you get
for the case where execCurrentOf can't identify the target scan node at
all, "cursor "foo" is not a simply updatable scan of table "bar"".
Perhaps it should be different, but we can always adjust that later.

In the future, it might be nice to provide hooks that would let custom
scan providers and/or FDWs deal with this in other ways; but that's
not a suitable topic for a back-patchable bug fix.

It's been like this all along, so back-patch to all supported branches.

Yugo Nagata and Tom Lane

Discussion: https://postgr.es/m/20180201013349.937dfc5f.nagata@sraoss.co.jp

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ee7bf0fd9fa7ed4a99e9cf1b9e97409f46a3eb40

Modified Files
--------------
src/backend/access/common/heaptuple.c | 26 ++++++++++++
src/backend/executor/execCurrent.c    | 79 ++++++++++++++++++++++++++---------
src/include/executor/tuptable.h       |  2 +
src/test/regress/expected/portals.out | 24 +++++++++++
src/test/regress/sql/portals.sql      | 10 +++++
5 files changed, 121 insertions(+), 20 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on
@ 2018-03-17 19:00 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2018-03-17 19:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix WHERE CURRENT OF when the referenced cursor uses an index-only scan.

"UPDATE/DELETE WHERE CURRENT OF cursor_name" failed, with an error message
like "cannot extract system attribute from virtual tuple", if the cursor
was using a index-only scan for the target table.  Fix it by digging the
current TID out of the indexscan state.

It seems likely that the same failure could occur for CustomScan plans
and perhaps some FDW plan types, so that leaving this to be treated as an
internal error with an obscure message isn't as good an idea as it first
seemed.  Hence, add a bit of heaptuple.c infrastructure to let us deliver
a more on-topic message.  I chose to make the message match what you get
for the case where execCurrentOf can't identify the target scan node at
all, "cursor "foo" is not a simply updatable scan of table "bar"".
Perhaps it should be different, but we can always adjust that later.

In the future, it might be nice to provide hooks that would let custom
scan providers and/or FDWs deal with this in other ways; but that's
not a suitable topic for a back-patchable bug fix.

It's been like this all along, so back-patch to all supported branches.

Yugo Nagata and Tom Lane

Discussion: https://postgr.es/m/20180201013349.937dfc5f.nagata@sraoss.co.jp

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/12d18b4870a2561e39d36999c5ba94899ac07f44

Modified Files
--------------
src/backend/access/common/heaptuple.c | 26 ++++++++++++
src/backend/executor/execCurrent.c    | 79 ++++++++++++++++++++++++++---------
src/include/executor/tuptable.h       |  2 +
src/test/regress/expected/portals.out | 24 +++++++++++
src/test/regress/sql/portals.sql      | 10 +++++
5 files changed, 121 insertions(+), 20 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on
@ 2018-03-17 19:00 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2018-03-17 19:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix WHERE CURRENT OF when the referenced cursor uses an index-only scan.

"UPDATE/DELETE WHERE CURRENT OF cursor_name" failed, with an error message
like "cannot extract system attribute from virtual tuple", if the cursor
was using a index-only scan for the target table.  Fix it by digging the
current TID out of the indexscan state.

It seems likely that the same failure could occur for CustomScan plans
and perhaps some FDW plan types, so that leaving this to be treated as an
internal error with an obscure message isn't as good an idea as it first
seemed.  Hence, add a bit of heaptuple.c infrastructure to let us deliver
a more on-topic message.  I chose to make the message match what you get
for the case where execCurrentOf can't identify the target scan node at
all, "cursor "foo" is not a simply updatable scan of table "bar"".
Perhaps it should be different, but we can always adjust that later.

In the future, it might be nice to provide hooks that would let custom
scan providers and/or FDWs deal with this in other ways; but that's
not a suitable topic for a back-patchable bug fix.

It's been like this all along, so back-patch to all supported branches.

Yugo Nagata and Tom Lane

Discussion: https://postgr.es/m/20180201013349.937dfc5f.nagata@sraoss.co.jp

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7de7ddb27a868f7bf2e5f802752723041dd32d60

Modified Files
--------------
src/backend/access/common/heaptuple.c | 26 ++++++++++++
src/backend/executor/execCurrent.c    | 79 ++++++++++++++++++++++++++---------
src/include/executor/tuptable.h       |  2 +
src/test/regress/expected/portals.out | 24 +++++++++++
src/test/regress/sql/portals.sql      | 10 +++++
5 files changed, 121 insertions(+), 20 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on
@ 2018-03-17 19:00 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2018-03-17 19:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix WHERE CURRENT OF when the referenced cursor uses an index-only scan.

"UPDATE/DELETE WHERE CURRENT OF cursor_name" failed, with an error message
like "cannot extract system attribute from virtual tuple", if the cursor
was using a index-only scan for the target table.  Fix it by digging the
current TID out of the indexscan state.

It seems likely that the same failure could occur for CustomScan plans
and perhaps some FDW plan types, so that leaving this to be treated as an
internal error with an obscure message isn't as good an idea as it first
seemed.  Hence, add a bit of heaptuple.c infrastructure to let us deliver
a more on-topic message.  I chose to make the message match what you get
for the case where execCurrentOf can't identify the target scan node at
all, "cursor "foo" is not a simply updatable scan of table "bar"".
Perhaps it should be different, but we can always adjust that later.

In the future, it might be nice to provide hooks that would let custom
scan providers and/or FDWs deal with this in other ways; but that's
not a suitable topic for a back-patchable bug fix.

It's been like this all along, so back-patch to all supported branches.

Yugo Nagata and Tom Lane

Discussion: https://postgr.es/m/20180201013349.937dfc5f.nagata@sraoss.co.jp

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0a0721f84c40ef3a511cd1b233579777b71d8bce

Modified Files
--------------
src/backend/access/common/heaptuple.c | 26 ++++++++++++
src/backend/executor/execCurrent.c    | 79 ++++++++++++++++++++++++++---------
src/include/executor/tuptable.h       |  2 +
src/test/regress/expected/portals.out | 24 +++++++++++
src/test/regress/sql/portals.sql      | 10 +++++
5 files changed, 121 insertions(+), 20 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on
@ 2018-03-17 19:00 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2018-03-17 19:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix WHERE CURRENT OF when the referenced cursor uses an index-only scan.

"UPDATE/DELETE WHERE CURRENT OF cursor_name" failed, with an error message
like "cannot extract system attribute from virtual tuple", if the cursor
was using a index-only scan for the target table.  Fix it by digging the
current TID out of the indexscan state.

It seems likely that the same failure could occur for CustomScan plans
and perhaps some FDW plan types, so that leaving this to be treated as an
internal error with an obscure message isn't as good an idea as it first
seemed.  Hence, add a bit of heaptuple.c infrastructure to let us deliver
a more on-topic message.  I chose to make the message match what you get
for the case where execCurrentOf can't identify the target scan node at
all, "cursor "foo" is not a simply updatable scan of table "bar"".
Perhaps it should be different, but we can always adjust that later.

In the future, it might be nice to provide hooks that would let custom
scan providers and/or FDWs deal with this in other ways; but that's
not a suitable topic for a back-patchable bug fix.

It's been like this all along, so back-patch to all supported branches.

Yugo Nagata and Tom Lane

Discussion: https://postgr.es/m/20180201013349.937dfc5f.nagata@sraoss.co.jp

Branch
------
REL9_3_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5b77c11da24a4dc14d24d833bbb81390c72f52fe

Modified Files
--------------
src/backend/access/common/heaptuple.c | 26 ++++++++++++
src/backend/executor/execCurrent.c    | 79 ++++++++++++++++++++++++++---------
src/include/executor/tuptable.h       |  2 +
src/test/regress/expected/portals.out | 24 +++++++++++
src/test/regress/sql/portals.sql      | 10 +++++
5 files changed, 121 insertions(+), 20 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2018-03-17 19:00 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-17 19:00 pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on Tom Lane <tgl@sss.pgh.pa.us>
2018-03-17 19:00 pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on Tom Lane <tgl@sss.pgh.pa.us>
2018-03-17 19:00 pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on Tom Lane <tgl@sss.pgh.pa.us>
2018-03-17 19:00 pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on Tom Lane <tgl@sss.pgh.pa.us>
2018-03-17 19:00 pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on Tom Lane <tgl@sss.pgh.pa.us>
2018-03-17 19:00 pgsql: Fix WHERE CURRENT OF when the referenced cursor uses an index-on Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox