pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: postgres_fdw: Avoid "cursor can only scan forward" error. 4+ messages / 1 participants [nested] [flat]
* pgsql: postgres_fdw: Avoid "cursor can only scan forward" error. @ 2024-07-19 04:24 Etsuro Fujita <efujita@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Etsuro Fujita @ 2024-07-19 04:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Avoid "cursor can only scan forward" error. Commit d844cd75a disallowed rewind in a non-scrollable cursor to resolve anomalies arising from such a cursor operation. However, this failed to take into account the assumption in postgres_fdw that when rescanning a foreign relation, it can rewind the cursor created for scanning the foreign relation without specifying the SCROLL option, regardless of its scrollability, causing this error when it tried to do such a rewind in a non-scrollable cursor. Fix by modifying postgres_fdw to instead recreate the cursor, regardless of its scrollability, when rescanning the foreign relation. (If we had a way to check its scrollability, we could improve this by rewinding it if it is scrollable and recreating it if not, but we do not have it, so this commit modifies it to recreate it in any case.) Per bug #17889 from Eric Cyr. Devrim Gunduz also reported this problem. Back-patch to v15 where that commit enforced the prohibition. Reviewed by Tom Lane. Discussion: https://postgr.es/m/17889-e8c39a251d258dda%40postgresql.org Discussion: https://postgr.es/m/b415ac3255f8352d1ea921cf3b7ba39e0587768a.camel%40gunduz.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/5c571a34d0e99bb7df7aedd26b90ff490cd6d9ee Modified Files -------------- contrib/postgres_fdw/expected/postgres_fdw.out | 45 ++++++++++++++++++++++++++ contrib/postgres_fdw/postgres_fdw.c | 20 +++++++++--- contrib/postgres_fdw/sql/postgres_fdw.sql | 25 ++++++++++++++ 3 files changed, 85 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: postgres_fdw: Avoid "cursor can only scan forward" error. @ 2024-07-19 04:24 Etsuro Fujita <efujita@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Etsuro Fujita @ 2024-07-19 04:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Avoid "cursor can only scan forward" error. Commit d844cd75a disallowed rewind in a non-scrollable cursor to resolve anomalies arising from such a cursor operation. However, this failed to take into account the assumption in postgres_fdw that when rescanning a foreign relation, it can rewind the cursor created for scanning the foreign relation without specifying the SCROLL option, regardless of its scrollability, causing this error when it tried to do such a rewind in a non-scrollable cursor. Fix by modifying postgres_fdw to instead recreate the cursor, regardless of its scrollability, when rescanning the foreign relation. (If we had a way to check its scrollability, we could improve this by rewinding it if it is scrollable and recreating it if not, but we do not have it, so this commit modifies it to recreate it in any case.) Per bug #17889 from Eric Cyr. Devrim Gunduz also reported this problem. Back-patch to v15 where that commit enforced the prohibition. Reviewed by Tom Lane. Discussion: https://postgr.es/m/17889-e8c39a251d258dda%40postgresql.org Discussion: https://postgr.es/m/b415ac3255f8352d1ea921cf3b7ba39e0587768a.camel%40gunduz.org Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/935fe79ea1fb76e32807ebc18f46bbbb9b1cf9b2 Modified Files -------------- contrib/postgres_fdw/expected/postgres_fdw.out | 45 ++++++++++++++++++++++++++ contrib/postgres_fdw/postgres_fdw.c | 20 +++++++++--- contrib/postgres_fdw/sql/postgres_fdw.sql | 25 ++++++++++++++ 3 files changed, 85 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: postgres_fdw: Avoid "cursor can only scan forward" error. @ 2024-07-19 04:24 Etsuro Fujita <efujita@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Etsuro Fujita @ 2024-07-19 04:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Avoid "cursor can only scan forward" error. Commit d844cd75a disallowed rewind in a non-scrollable cursor to resolve anomalies arising from such a cursor operation. However, this failed to take into account the assumption in postgres_fdw that when rescanning a foreign relation, it can rewind the cursor created for scanning the foreign relation without specifying the SCROLL option, regardless of its scrollability, causing this error when it tried to do such a rewind in a non-scrollable cursor. Fix by modifying postgres_fdw to instead recreate the cursor, regardless of its scrollability, when rescanning the foreign relation. (If we had a way to check its scrollability, we could improve this by rewinding it if it is scrollable and recreating it if not, but we do not have it, so this commit modifies it to recreate it in any case.) Per bug #17889 from Eric Cyr. Devrim Gunduz also reported this problem. Back-patch to v15 where that commit enforced the prohibition. Reviewed by Tom Lane. Discussion: https://postgr.es/m/17889-e8c39a251d258dda%40postgresql.org Discussion: https://postgr.es/m/b415ac3255f8352d1ea921cf3b7ba39e0587768a.camel%40gunduz.org Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d97f2ee50e49046a984665fb72fa14a06bd58435 Modified Files -------------- contrib/postgres_fdw/expected/postgres_fdw.out | 45 ++++++++++++++++++++++++++ contrib/postgres_fdw/postgres_fdw.c | 20 +++++++++--- contrib/postgres_fdw/sql/postgres_fdw.sql | 25 ++++++++++++++ 3 files changed, 85 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: postgres_fdw: Avoid "cursor can only scan forward" error. @ 2024-07-19 04:24 Etsuro Fujita <efujita@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Etsuro Fujita @ 2024-07-19 04:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Avoid "cursor can only scan forward" error. Commit d844cd75a disallowed rewind in a non-scrollable cursor to resolve anomalies arising from such a cursor operation. However, this failed to take into account the assumption in postgres_fdw that when rescanning a foreign relation, it can rewind the cursor created for scanning the foreign relation without specifying the SCROLL option, regardless of its scrollability, causing this error when it tried to do such a rewind in a non-scrollable cursor. Fix by modifying postgres_fdw to instead recreate the cursor, regardless of its scrollability, when rescanning the foreign relation. (If we had a way to check its scrollability, we could improve this by rewinding it if it is scrollable and recreating it if not, but we do not have it, so this commit modifies it to recreate it in any case.) Per bug #17889 from Eric Cyr. Devrim Gunduz also reported this problem. Back-patch to v15 where that commit enforced the prohibition. Reviewed by Tom Lane. Discussion: https://postgr.es/m/17889-e8c39a251d258dda%40postgresql.org Discussion: https://postgr.es/m/b415ac3255f8352d1ea921cf3b7ba39e0587768a.camel%40gunduz.org Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f39f3e0fbe9b323aba41cf8c258f17259ab69a85 Modified Files -------------- contrib/postgres_fdw/expected/postgres_fdw.out | 45 ++++++++++++++++++++++++++ contrib/postgres_fdw/postgres_fdw.c | 20 +++++++++--- contrib/postgres_fdw/sql/postgres_fdw.sql | 25 ++++++++++++++ 3 files changed, 85 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2024-07-19 04:24 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-07-19 04:24 pgsql: postgres_fdw: Avoid "cursor can only scan forward" error. Etsuro Fujita <efujita@postgresql.org> 2024-07-19 04:24 pgsql: postgres_fdw: Avoid "cursor can only scan forward" error. Etsuro Fujita <efujita@postgresql.org> 2024-07-19 04:24 pgsql: postgres_fdw: Avoid "cursor can only scan forward" error. Etsuro Fujita <efujita@postgresql.org> 2024-07-19 04:24 pgsql: postgres_fdw: Avoid "cursor can only scan forward" error. Etsuro Fujita <efujita@postgresql.org>
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