Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6478896

Browse files
committed
Teach hash_ok_operator() that record_eq is only sometimes hashable.
The need for this was foreseen long ago, but when record_eqactually became hashable (in commit01e658f), we missed updatingthis spot.Per bug #17363 from Elvis Pranskevichus. Back-patch to v14 wherethe faulty commit came in.Discussion:https://postgr.es/m/17363-f6d42fd0d726be02@postgresql.org
1 parentfe75517 commit6478896

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

‎src/backend/optimizer/plan/subselect.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -848,10 +848,10 @@ hash_ok_operator(OpExpr *expr)
848848
/* quick out if not a binary operator */
849849
if (list_length(expr->args)!=2)
850850
return false;
851-
if (opid==ARRAY_EQ_OP)
851+
if (opid==ARRAY_EQ_OP||
852+
opid==RECORD_EQ_OP)
852853
{
853-
/* array_eq is strict, but must check input type to ensure hashable */
854-
/* XXX record_eq will need same treatment when it becomes hashable */
854+
/* these are strict, but must check input type to ensure hashable */
855855
Node*leftarg=linitial(expr->args);
856856

857857
returnop_hashjoinable(opid,exprType(leftarg));

‎src/test/regress/expected/subselect.out

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,29 @@ select 'foo'::text in (select 'bar'::name union all select 'bar'::name);
789789
f
790790
(1 row)
791791

792+
--
793+
-- Test that we don't try to hash nested records (bug #17363)
794+
-- (Hashing could be supported, but for now we don't)
795+
--
796+
explain (verbose, costs off)
797+
select row(row(row(1))) = any (select row(row(1)));
798+
QUERY PLAN
799+
-------------------------------------------
800+
Result
801+
Output: (SubPlan 1)
802+
SubPlan 1
803+
-> Materialize
804+
Output: '("(1)")'::record
805+
-> Result
806+
Output: '("(1)")'::record
807+
(7 rows)
808+
809+
select row(row(row(1))) = any (select row(row(1)));
810+
?column?
811+
----------
812+
t
813+
(1 row)
814+
792815
--
793816
-- Test case for premature memory release during hashing of subplan output
794817
--

‎src/test/regress/sql/subselect.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,16 @@ select 'foo'::text in (select 'bar'::name union all select 'bar'::name);
463463

464464
select'foo'::textin (select'bar'::nameunion allselect'bar'::name);
465465

466+
--
467+
-- Test that we don't try to hash nested records (bug #17363)
468+
-- (Hashing could be supported, but for now we don't)
469+
--
470+
471+
explain (verbose, costs off)
472+
select row(row(row(1)))= any (select row(row(1)));
473+
474+
select row(row(row(1)))= any (select row(row(1)));
475+
466476
--
467477
-- Test case for premature memory release during hashing of subplan output
468478
--

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp