pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix possible loss of sync between rectypeid and underlying PLpgS
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix possible loss of sync between rectypeid and underlying PLpgS
@ 2019-12-26 20:19 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2019-12-26 20:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix possible loss of sync between rectypeid and underlying PLpgSQL_type.

When revalidate_rectypeid() acts to update a stale record type OID
in plpgsql's data structures, it fixes the active PLpgSQL_rec struct
as well as the PLpgSQL_type struct it references.  However, the latter
is shared across function executions while the former is not.  In a
later function execution, the PLpgSQL_rec struct would be reinitialized
by copy_plpgsql_datums and would then contain a stale type OID,
typically leading to "could not open relation with OID NNNN" errors.
revalidate_rectypeid() can easily fix this, fortunately, just by
treating typ->typoid as authoritative.

Per report and diagnosis from Ashutosh Sharma, though this is not his
suggested fix.  Back-patch to v11 where this code came in.

Discussion: https://postgr.es/m/CAE9k0Pkd4dZwt9J5pS9xhJFWpUtqs05C9xk_GEwPzYdV=GxwWg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4ba4bfaf256c17fe4c8f497924b74eb98241b84f

Modified Files
--------------
src/pl/plpgsql/src/expected/plpgsql_record.out |  6 ++++++
src/pl/plpgsql/src/pl_exec.c                   | 11 ++++++++++-
src/pl/plpgsql/src/sql/plpgsql_record.sql      |  1 +
3 files changed, 17 insertions(+), 1 deletion(-)



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

* pgsql: Fix possible loss of sync between rectypeid and underlying PLpgS
@ 2019-12-26 20:19 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2019-12-26 20:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix possible loss of sync between rectypeid and underlying PLpgSQL_type.

When revalidate_rectypeid() acts to update a stale record type OID
in plpgsql's data structures, it fixes the active PLpgSQL_rec struct
as well as the PLpgSQL_type struct it references.  However, the latter
is shared across function executions while the former is not.  In a
later function execution, the PLpgSQL_rec struct would be reinitialized
by copy_plpgsql_datums and would then contain a stale type OID,
typically leading to "could not open relation with OID NNNN" errors.
revalidate_rectypeid() can easily fix this, fortunately, just by
treating typ->typoid as authoritative.

Per report and diagnosis from Ashutosh Sharma, though this is not his
suggested fix.  Back-patch to v11 where this code came in.

Discussion: https://postgr.es/m/CAE9k0Pkd4dZwt9J5pS9xhJFWpUtqs05C9xk_GEwPzYdV=GxwWg@mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/883c27a1cf9b80d9a1cf13f527ad21024fa1849d

Modified Files
--------------
src/pl/plpgsql/src/expected/plpgsql_record.out |  6 ++++++
src/pl/plpgsql/src/pl_exec.c                   | 11 ++++++++++-
src/pl/plpgsql/src/sql/plpgsql_record.sql      |  1 +
3 files changed, 17 insertions(+), 1 deletion(-)



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

* pgsql: Fix possible loss of sync between rectypeid and underlying PLpgS
@ 2019-12-26 20:19 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2019-12-26 20:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix possible loss of sync between rectypeid and underlying PLpgSQL_type.

When revalidate_rectypeid() acts to update a stale record type OID
in plpgsql's data structures, it fixes the active PLpgSQL_rec struct
as well as the PLpgSQL_type struct it references.  However, the latter
is shared across function executions while the former is not.  In a
later function execution, the PLpgSQL_rec struct would be reinitialized
by copy_plpgsql_datums and would then contain a stale type OID,
typically leading to "could not open relation with OID NNNN" errors.
revalidate_rectypeid() can easily fix this, fortunately, just by
treating typ->typoid as authoritative.

Per report and diagnosis from Ashutosh Sharma, though this is not his
suggested fix.  Back-patch to v11 where this code came in.

Discussion: https://postgr.es/m/CAE9k0Pkd4dZwt9J5pS9xhJFWpUtqs05C9xk_GEwPzYdV=GxwWg@mail.gmail.com

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/pl/plpgsql/src/expected/plpgsql_record.out |  6 ++++++
src/pl/plpgsql/src/pl_exec.c                   | 11 ++++++++++-
src/pl/plpgsql/src/sql/plpgsql_record.sql      |  1 +
3 files changed, 17 insertions(+), 1 deletion(-)



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


end of thread, other threads:[~2019-12-26 20:19 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-26 20:19 pgsql: Fix possible loss of sync between rectypeid and underlying PLpgS Tom Lane <tgl@sss.pgh.pa.us>
2019-12-26 20:19 pgsql: Fix possible loss of sync between rectypeid and underlying PLpgS Tom Lane <tgl@sss.pgh.pa.us>
2019-12-26 20:19 pgsql: Fix possible loss of sync between rectypeid and underlying PLpgS 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