Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 45cc0e9

Browse files
committed
plpgsql RAISE statement was careless about the possibility of a NULL
field value being displayed; produced coredump instead of the expected <NULL> display.
1 parent f106779 commit 45cc0e9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/pl/plpgsql/src/pl_exec.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.20 2000/04/12 17:17:19 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.21 2000/04/28 00:12:44 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -1587,6 +1587,8 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
15871587
if (fno == SPI_ERROR_NOATTRIBUTE)
15881588
elog(ERROR, "record %s has no field %s", rec->refname, recfield->fieldname);
15891589
extval = SPI_getvalue(rec->tup, rec->tupdesc, fno);
1590+
if (extval == NULL)
1591+
extval = "<NULL>";
15901592
}
15911593
plpgsql_dstring_append(&ds, extval);
15921594
break;

0 commit comments

Comments
 (0)