Skip to content

Commit be231f0

Browse files
committed
fix infinite bounds in view 'pathman_partition_list'
1 parent 1204842 commit be231f0

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

expected/pathman_basic.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,14 +1376,14 @@ SELECT pathman.attach_range_partition('test.range_rel', 'test.range_rel_minus_in
13761376
SELECT * FROM pathman.pathman_partition_list WHERE parent = 'test.range_rel'::REGCLASS;
13771377
parent | partition | parttype | partattr | range_min | range_max
13781378
----------------+-------------------------------+----------+----------+--------------------------+--------------------------
1379-
test.range_rel | test.range_rel_minus_infinity | 2 | dt | NULL | Mon Dec 01 00:00:00 2014
1379+
test.range_rel | test.range_rel_minus_infinity | 2 | dt | | Mon Dec 01 00:00:00 2014
13801380
test.range_rel | test.range_rel_8 | 2 | dt | Mon Dec 01 00:00:00 2014 | Thu Jan 01 00:00:00 2015
13811381
test.range_rel | test.range_rel_1 | 2 | dt | Thu Jan 01 00:00:00 2015 | Sun Feb 01 00:00:00 2015
13821382
test.range_rel | test.range_rel_2 | 2 | dt | Sun Feb 01 00:00:00 2015 | Sun Mar 01 00:00:00 2015
13831383
test.range_rel | test.range_rel_3 | 2 | dt | Sun Mar 01 00:00:00 2015 | Wed Apr 01 00:00:00 2015
13841384
test.range_rel | test.range_rel_4 | 2 | dt | Wed Apr 01 00:00:00 2015 | Fri May 01 00:00:00 2015
13851385
test.range_rel | test.range_rel_6 | 2 | dt | Fri May 01 00:00:00 2015 | Mon Jun 01 00:00:00 2015
1386-
test.range_rel | test.range_rel_plus_infinity | 2 | dt | Mon Jun 01 00:00:00 2015 | NULL
1386+
test.range_rel | test.range_rel_plus_infinity | 2 | dt | Mon Jun 01 00:00:00 2015 |
13871387
(8 rows)
13881388

13891389
INSERT INTO test.range_rel (dt) VALUES ('2012-06-15');

src/pl_funcs.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -398,28 +398,32 @@ show_partition_list_internal(PG_FUNCTION_ARGS)
398398
case PT_RANGE:
399399
{
400400
RangeEntry *re;
401-
Datum rmin,
402-
rmax;
403401

404402
re = &PrelGetRangesArray(prel)[usercxt->child_number];
405403

404+
values[Anum_pathman_pl_partition - 1] = re->child_oid;
405+
406406
/* Lower bound text */
407-
rmin = !IsInfinite(&re->min) ?
408-
CStringGetTextDatum(
407+
if (!IsInfinite(&re->min))
408+
{
409+
Datum rmin = CStringGetTextDatum(
409410
datum_to_cstring(BoundGetValue(&re->min),
410-
prel->atttype)) :
411-
CStringGetTextDatum("NULL");
411+
prel->atttype));
412+
413+
values[Anum_pathman_pl_range_min - 1] = rmin;
414+
}
415+
else isnull[Anum_pathman_pl_range_min - 1] = true;
412416

413417
/* Upper bound text */
414-
rmax = !IsInfinite(&re->max) ?
415-
CStringGetTextDatum(
418+
if (!IsInfinite(&re->max))
419+
{
420+
Datum rmax = CStringGetTextDatum(
416421
datum_to_cstring(BoundGetValue(&re->max),
417-
prel->atttype)) :
418-
CStringGetTextDatum("NULL");
422+
prel->atttype));
419423

420-
values[Anum_pathman_pl_partition - 1] = re->child_oid;
421-
values[Anum_pathman_pl_range_min - 1] = rmin;
422-
values[Anum_pathman_pl_range_max - 1] = rmax;
424+
values[Anum_pathman_pl_range_max - 1] = rmax;
425+
}
426+
else isnull[Anum_pathman_pl_range_max - 1] = true;
423427
}
424428
break;
425429

0 commit comments

Comments
 (0)