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

Commitbf4ae68

Browse files
committed
Fix tqueue.c's range-remapping code.
It's depressingly clear that nobody ever tested this.
1 parent80b346c commitbf4ae68

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

‎src/backend/executor/tqueue.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ tqueueWalkRange(TQueueDestReceiver *tqueue, Datum value)
371371
* called in the first place: GetRemapClass should have returned NULL when
372372
* asked about this range type.
373373
*/
374-
remapclass=GetRemapClass(typeid);
374+
remapclass=GetRemapClass(typcache->rngelemtype->type_id);
375375
Assert(remapclass!=TQUEUE_REMAP_NONE);
376376

377377
/* Walk each bound, if present. */
@@ -749,7 +749,7 @@ TupleQueueRemapRange(TupleQueueReader *reader, Datum value)
749749
* called in the first place: GetRemapClass should have returned NULL when
750750
* asked about this range type.
751751
*/
752-
remapclass=GetRemapClass(typeid);
752+
remapclass=GetRemapClass(typcache->rngelemtype->type_id);
753753
Assert(remapclass!=TQUEUE_REMAP_NONE);
754754

755755
/* Remap each bound, if present. */

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,23 @@ select array[1,3] <@ arrayrange(array[1,2], array[2,1]);
13361336
t
13371337
(1 row)
13381338

1339+
--
1340+
-- Ranges of composites
1341+
--
1342+
create type two_ints as (a int, b int);
1343+
create type two_ints_range as range (subtype = two_ints);
1344+
-- with force_parallel_mode on, this exercises tqueue.c's range remapping
1345+
select *, row_to_json(upper(t)) as u from
1346+
(values (two_ints_range(row(1,2), row(3,4))),
1347+
(two_ints_range(row(5,6), row(7,8)))) v(t);
1348+
t | u
1349+
-------------------+---------------
1350+
["(1,2)","(3,4)") | {"a":3,"b":4}
1351+
["(5,6)","(7,8)") | {"a":7,"b":8}
1352+
(2 rows)
1353+
1354+
drop type two_ints cascade;
1355+
NOTICE: drop cascades to type two_ints_range
13391356
--
13401357
-- OUT/INOUT/TABLE functions
13411358
--

‎src/test/regress/sql/rangetypes.sql

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,20 @@ select arrayrange(ARRAY[2,1], ARRAY[1,2]); -- fail
447447
select array[1,1]<@ arrayrange(array[1,2], array[2,1]);
448448
select array[1,3]<@ arrayrange(array[1,2], array[2,1]);
449449

450+
--
451+
-- Ranges of composites
452+
--
453+
454+
createtypetwo_intsas (aint, bint);
455+
createtypetwo_ints_rangeas range (subtype= two_ints);
456+
457+
-- with force_parallel_mode on, this exercises tqueue.c's range remapping
458+
select*, row_to_json(upper(t))as ufrom
459+
(values (two_ints_range(row(1,2), row(3,4))),
460+
(two_ints_range(row(5,6), row(7,8)))) v(t);
461+
462+
droptype two_ints cascade;
463+
450464
--
451465
-- OUT/INOUT/TABLE functions
452466
--

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp