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

Commit3ad7dbb

Browse files
committed
Don't choke when exec_move_row assigns a synthesized null to a column
that happens to be composite itself. Per bug #5314 from Oleg Serov.Backpatch to 8.0 --- 7.4 has got too many other shortcomings incomposite-type support to make this worth worrying about in that branch.
1 parent1b04b8f commit3ad7dbb

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

‎src/pl/plpgsql/src/pl_exec.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.254 2010/01/19 01:35:31 tgl Exp $
11+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.255 2010/02/12 19:37:36 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -3520,11 +3520,6 @@ exec_assign_value(PLpgSQL_execstate *estate,
35203520
*/
35213521
PLpgSQL_row*row= (PLpgSQL_row*)target;
35223522

3523-
/* Source must be of RECORD or composite type */
3524-
if (!type_is_rowtype(valtype))
3525-
ereport(ERROR,
3526-
(errcode(ERRCODE_DATATYPE_MISMATCH),
3527-
errmsg("cannot assign non-composite value to a row variable")));
35283523
if (*isNull)
35293524
{
35303525
/* If source is null, just assign nulls to the row */
@@ -3538,7 +3533,12 @@ exec_assign_value(PLpgSQL_execstate *estate,
35383533
TupleDesctupdesc;
35393534
HeapTupleDatatmptup;
35403535

3541-
/* Else source is a tuple Datum, safe to do this: */
3536+
/* Source must be of RECORD or composite type */
3537+
if (!type_is_rowtype(valtype))
3538+
ereport(ERROR,
3539+
(errcode(ERRCODE_DATATYPE_MISMATCH),
3540+
errmsg("cannot assign non-composite value to a row variable")));
3541+
/* Source is a tuple Datum, so safe to do this: */
35423542
td=DatumGetHeapTupleHeader(value);
35433543
/* Extract rowtype info and find a tupdesc */
35443544
tupType=HeapTupleHeaderGetTypeId(td);
@@ -3562,11 +3562,6 @@ exec_assign_value(PLpgSQL_execstate *estate,
35623562
*/
35633563
PLpgSQL_rec*rec= (PLpgSQL_rec*)target;
35643564

3565-
/* Source must be of RECORD or composite type */
3566-
if (!type_is_rowtype(valtype))
3567-
ereport(ERROR,
3568-
(errcode(ERRCODE_DATATYPE_MISMATCH),
3569-
errmsg("cannot assign non-composite value to a record variable")));
35703565
if (*isNull)
35713566
{
35723567
/* If source is null, just assign nulls to the record */
@@ -3580,7 +3575,13 @@ exec_assign_value(PLpgSQL_execstate *estate,
35803575
TupleDesctupdesc;
35813576
HeapTupleDatatmptup;
35823577

3583-
/* Else source is a tuple Datum, safe to do this: */
3578+
/* Source must be of RECORD or composite type */
3579+
if (!type_is_rowtype(valtype))
3580+
ereport(ERROR,
3581+
(errcode(ERRCODE_DATATYPE_MISMATCH),
3582+
errmsg("cannot assign non-composite value to a record variable")));
3583+
3584+
/* Source is a tuple Datum, so safe to do this: */
35843585
td=DatumGetHeapTupleHeader(value);
35853586
/* Extract rowtype info and find a tupdesc */
35863587
tupType=HeapTupleHeaderGetTypeId(td);
@@ -4759,6 +4760,10 @@ exec_move_row(PLpgSQL_execstate *estate,
47594760
{
47604761
value= (Datum)0;
47614762
isnull= true;
4763+
/*
4764+
* InvalidOid is OK because exec_assign_value doesn't care
4765+
* about the type of a source NULL
4766+
*/
47624767
valtype=InvalidOid;
47634768
}
47644769

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp