pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Disable anonymous record hash support except in special cases
2+ messages / 1 participants
[nested] [flat]

* pgsql: Disable anonymous record hash support except in special cases
@ 2021-09-08 08:07 Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2021-09-08 08:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disable anonymous record hash support except in special cases

Commit 01e658fa74 added hash support for row types.  This also added
support for hashing anonymous record types, using the same approach
that the type cache uses for comparison support for record types: It
just reports that it works, but it might fail at run time if a
component type doesn't actually support the operation.  We get away
with that for comparison because most types support that.  But some
types don't support hashing, so the current state can result in
failures at run time where the planner chooses hashing over sorting,
whereas that previously worked if only sorting was an option.

We do, however, want the record hashing support for path tracking in
recursive unions, and the SEARCH and CYCLE clauses built on that.  In
that case, hashing is the only plan option.  So enable that, this
commit implements the following approach: The type cache does not
report that hashing is available for the record type.  This undoes
that part of 01e658fa74.  Instead, callers that require hashing no
matter what can override that result themselves.  This patch only
touches the callers to make the aforementioned recursive query cases
work, namely the parse analysis of unions, as well as the hash_array()
function.

Reported-by: Sait Talha Nisanci <sait.nisanci@microsoft.com>
Bug: #17158
Discussion: https://www.postgresql.org/message-id/flat/17158-8a2ba823982537a4%40postgresql.org

Branch
------
master

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

Modified Files
--------------
src/backend/parser/analyze.c             | 23 ++++++--
src/backend/rewrite/rewriteSearchCycle.c |  6 +--
src/backend/utils/adt/arrayfuncs.c       | 36 ++++++++++++-
src/backend/utils/cache/typcache.c       | 11 ++--
src/include/parser/analyze.h             |  2 +-
src/test/regress/expected/union.out      | 90 ++++++++++++++++++--------------
src/test/regress/sql/union.sql           |  4 +-
7 files changed, 117 insertions(+), 55 deletions(-)



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

* pgsql: Disable anonymous record hash support except in special cases
@ 2021-09-08 08:07 Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2021-09-08 08:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disable anonymous record hash support except in special cases

Commit 01e658fa74 added hash support for row types.  This also added
support for hashing anonymous record types, using the same approach
that the type cache uses for comparison support for record types: It
just reports that it works, but it might fail at run time if a
component type doesn't actually support the operation.  We get away
with that for comparison because most types support that.  But some
types don't support hashing, so the current state can result in
failures at run time where the planner chooses hashing over sorting,
whereas that previously worked if only sorting was an option.

We do, however, want the record hashing support for path tracking in
recursive unions, and the SEARCH and CYCLE clauses built on that.  In
that case, hashing is the only plan option.  So enable that, this
commit implements the following approach: The type cache does not
report that hashing is available for the record type.  This undoes
that part of 01e658fa74.  Instead, callers that require hashing no
matter what can override that result themselves.  This patch only
touches the callers to make the aforementioned recursive query cases
work, namely the parse analysis of unions, as well as the hash_array()
function.

Reported-by: Sait Talha Nisanci <sait.nisanci@microsoft.com>
Bug: #17158
Discussion: https://www.postgresql.org/message-id/flat/17158-8a2ba823982537a4%40postgresql.org

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/054adca641ac1279dc8d9b74fda41948ac35e9a9

Modified Files
--------------
src/backend/parser/analyze.c             | 23 ++++++--
src/backend/rewrite/rewriteSearchCycle.c |  6 +--
src/backend/utils/adt/arrayfuncs.c       | 36 ++++++++++++-
src/backend/utils/cache/typcache.c       | 11 ++--
src/include/parser/analyze.h             |  2 +-
src/test/regress/expected/union.out      | 90 ++++++++++++++++++--------------
src/test/regress/sql/union.sql           |  4 +-
7 files changed, 117 insertions(+), 55 deletions(-)



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


end of thread, other threads:[~2021-09-08 08:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 08:07 pgsql: Disable anonymous record hash support except in special cases Peter Eisentraut <peter@eisentraut.org>
2021-09-08 08:07 pgsql: Disable anonymous record hash support except in special cases Peter Eisentraut <peter@eisentraut.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