git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: fbe0232) | patch
Fix possible loss of sync between rectypeid and underlying PLpgSQL_type.
2019年12月26日 20:19:39 +0000 (15:19 -0500)
2019年12月26日 20:19:39 +0000 (15:19 -0500)
commit 4ba4bfaf256c17fe4c8f497924b74eb98241b84f
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
src/pl/plpgsql/src/expected/plpgsql_record.out diff | blob | blame | history
src/pl/plpgsql/src/pl_exec.c diff | blob | blame | history
src/pl/plpgsql/src/sql/plpgsql_record.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /