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

Commit50c8348

Browse files
committed
PG_TRY without PG_RE_THROW is no-no: remove it from is_tuple_convertible.
Noticed by errordata_stack_depth overflow: log wasn't flushed.
1 parentdbf8262 commit50c8348

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

‎hash.sql‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ BEGIN
9494
END IF;
9595

9696
/* Check that new partition has an equal structure as parent does*/
97-
IF NOT @extschema@.is_tuple_convertible(parent_relid, new_partition) THEN
97+
BEGIN
98+
PERFORM @extschema@.is_tuple_convertible(parent_relid, new_partition);
99+
EXCEPTION WHEN OTHERS THEN
98100
RAISE EXCEPTION'partition must have a compatible tuple format';
99-
END IF;
101+
END;
100102

101103
/* Check that table is partitioned*/
102104
IF @extschema@.get_partition_key(parent_relid) ISNULL THEN

‎range.sql‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,9 +639,11 @@ BEGIN
639639
/* Check range overlap*/
640640
PERFORM @extschema@.check_range_available(parent_relid, start_value, end_value);
641641

642-
IF NOT @extschema@.is_tuple_convertible(parent_relid, partition_relid) THEN
642+
BEGIN
643+
PERFORM @extschema@.is_tuple_convertible(parent_relid, partition_relid);
644+
EXCEPTION WHEN OTHERS THEN
643645
RAISE EXCEPTION'partition must have a compatible tuple format';
644-
END IF;
646+
END;
645647

646648
part_expr := @extschema@.get_partition_key(parent_relid);
647649
part_type := @extschema@.get_partition_type(parent_relid);

‎src/pl_funcs.c‎

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -661,38 +661,32 @@ is_date_type(PG_FUNCTION_ARGS)
661661
PG_RETURN_BOOL(is_date_type_internal(PG_GETARG_OID(0)));
662662
}
663663

664+
/*
665+
* Bail out with ERROR if rel1 tuple can't be converted to rel2 tuple.
666+
*/
664667
Datum
665668
is_tuple_convertible(PG_FUNCTION_ARGS)
666669
{
667670
Relationrel1,
668671
rel2;
669-
boolres= true;
672+
void*map;/* we don't actually need it */
670673

671674
rel1=heap_open(PG_GETARG_OID(0),AccessShareLock);
672675
rel2=heap_open(PG_GETARG_OID(1),AccessShareLock);
673676

674-
PG_TRY();
675-
{
676-
void*map;/* we don't actually need it */
677-
678-
/* Try to build a conversion map */
679-
map=convert_tuples_by_name_map(RelationGetDescr(rel1),
680-
RelationGetDescr(rel2),
681-
ERR_PART_DESC_CONVERT);
677+
/* Try to build a conversion map */
678+
map=convert_tuples_by_name_map(RelationGetDescr(rel1),
679+
RelationGetDescr(rel2),
680+
ERR_PART_DESC_CONVERT);
682681

683-
/* Now free map */
684-
pfree(map);
685-
}
686-
PG_CATCH();
687-
{
688-
res= false;
689-
}
690-
PG_END_TRY();
682+
/* Now free map */
683+
pfree(map);
691684

692685
heap_close(rel1,AccessShareLock);
693686
heap_close(rel2,AccessShareLock);
694687

695-
PG_RETURN_BOOL(res);
688+
/* still return true to avoid changing tests */
689+
PG_RETURN_BOOL(true);
696690
}
697691

698692

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp