git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 80b346c)
Fix tqueue.c's range-remapping code.
2016年7月29日 18:13:19 +0000 (14:13 -0400)
2016年7月29日 18:13:19 +0000 (14:13 -0400)
It's depressingly clear that nobody ever tested this.


diff --git a/src/backend/executor/tqueue.c b/src/backend/executor/tqueue.c
index b5ae3d82b60caa5c7de79c93c264f077b8fa6878..e81c333e4cd90cc4f38f45805034ec26179b0cc6 100644 (file)
--- a/src/backend/executor/tqueue.c
+++ b/src/backend/executor/tqueue.c
@@ -371,7 +371,7 @@ tqueueWalkRange(TQueueDestReceiver *tqueue, Datum value)
* called in the first place: GetRemapClass should have returned NULL when
* asked about this range type.
*/
- remapclass = GetRemapClass(typeid);
+ remapclass = GetRemapClass(typcache->rngelemtype->type_id);
Assert(remapclass != TQUEUE_REMAP_NONE);
/* Walk each bound, if present. */
@@ -749,7 +749,7 @@ TupleQueueRemapRange(TupleQueueReader *reader, Datum value)
* called in the first place: GetRemapClass should have returned NULL when
* asked about this range type.
*/
- remapclass = GetRemapClass(typeid);
+ remapclass = GetRemapClass(typcache->rngelemtype->type_id);
Assert(remapclass != TQUEUE_REMAP_NONE);
/* Remap each bound, if present. */
diff --git a/src/test/regress/expected/rangetypes.out b/src/test/regress/expected/rangetypes.out
index 23cdbc3902b00b5c822293d981db8415e1c3038a..4a2336cd8d3a7dbc718c9e79525c4f3c692e994e 100644 (file)
--- a/src/test/regress/expected/rangetypes.out
+++ b/src/test/regress/expected/rangetypes.out
@@ -1336,6 +1336,23 @@ select array[1,3] <@ arrayrange(array[1,2], array[2,1]);
t
(1 row)
+--
+-- Ranges of composites
+--
+create type two_ints as (a int, b int);
+create type two_ints_range as range (subtype = two_ints);
+-- with force_parallel_mode on, this exercises tqueue.c's range remapping
+select *, row_to_json(upper(t)) as u from
+ (values (two_ints_range(row(1,2), row(3,4))),
+ (two_ints_range(row(5,6), row(7,8)))) v(t);
+ t | u
+-------------------+---------------
+ ["(1,2)","(3,4)") | {"a":3,"b":4}
+ ["(5,6)","(7,8)") | {"a":7,"b":8}
+(2 rows)
+
+drop type two_ints cascade;
+NOTICE: drop cascades to type two_ints_range
--
-- OUT/INOUT/TABLE functions
--
diff --git a/src/test/regress/sql/rangetypes.sql b/src/test/regress/sql/rangetypes.sql
index 6d2696f7bf2b1bfcb08536a61167f0ffff39a216..a60df9095e99435ee3e8c1a1328f3563f8511569 100644 (file)
--- a/src/test/regress/sql/rangetypes.sql
+++ b/src/test/regress/sql/rangetypes.sql
@@ -447,6 +447,20 @@ select arrayrange(ARRAY[2,1], ARRAY[1,2]); -- fail
select array[1,1] <@ arrayrange(array[1,2], array[2,1]);
select array[1,3] <@ arrayrange(array[1,2], array[2,1]);
+--
+-- Ranges of composites
+--
+
+create type two_ints as (a int, b int);
+create type two_ints_range as range (subtype = two_ints);
+
+-- with force_parallel_mode on, this exercises tqueue.c's range remapping
+select *, row_to_json(upper(t)) as u from
+ (values (two_ints_range(row(1,2), row(3,4))),
+ (two_ints_range(row(5,6), row(7,8)))) v(t);
+
+drop type two_ints cascade;
+
--
-- OUT/INOUT/TABLE functions
--
This is the main PostgreSQL git repository.
RSS Atom

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