|
1 | 1 | /**********************************************************************
|
2 | 2 | * plperl.c - perl as a procedural language for PostgreSQL
|
3 | 3 | *
|
4 |
| - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.170 2010/03/09 02:48:33 adunstan Exp $ |
| 4 | + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.171 2010/03/09 22:34:38 tgl Exp $ |
5 | 5 | *
|
6 | 6 | **********************************************************************/
|
7 | 7 |
|
@@ -976,7 +976,7 @@ plperl_modify_tuple(HV *hvTD, TriggerData *tdata, HeapTuple otup)
|
976 | 976 | ereport(ERROR,
|
977 | 977 | (errcode(ERRCODE_UNDEFINED_COLUMN),
|
978 | 978 | errmsg("$_TD->{new} does not exist")));
|
979 |
| - if (!SvOK(*svp) || SvTYPE(*svp) != SVt_RV || SvTYPE(SvRV(*svp)) != SVt_PVHV) |
| 979 | + if (!SvOK(*svp) || !SvROK(*svp) || SvTYPE(SvRV(*svp)) != SVt_PVHV) |
980 | 980 | ereport(ERROR,
|
981 | 981 | (errcode(ERRCODE_DATATYPE_MISMATCH),
|
982 | 982 | errmsg("$_TD->{new} is not a hash reference")));
|
@@ -1549,7 +1549,7 @@ plperl_func_handler(PG_FUNCTION_ARGS)
|
1549 | 1549 | * value is an error, except undef which means return an empty set.
|
1550 | 1550 | */
|
1551 | 1551 | if (SvOK(perlret) &&
|
1552 |
| - SvTYPE(perlret) == SVt_RV && |
| 1552 | + SvROK(perlret) && |
1553 | 1553 | SvTYPE(SvRV(perlret)) == SVt_PVAV)
|
1554 | 1554 | {
|
1555 | 1555 | int i = 0;
|
@@ -1594,7 +1594,7 @@ plperl_func_handler(PG_FUNCTION_ARGS)
|
1594 | 1594 | AttInMetadata *attinmeta;
|
1595 | 1595 | HeapTuple tup;
|
1596 | 1596 |
|
1597 |
| - if (!SvOK(perlret) || SvTYPE(perlret) != SVt_RV || |
| 1597 | + if (!SvOK(perlret) || !SvROK(perlret) || |
1598 | 1598 | SvTYPE(SvRV(perlret)) != SVt_PVHV)
|
1599 | 1599 | {
|
1600 | 1600 | ereport(ERROR,
|
@@ -2220,7 +2220,7 @@ plperl_return_next(SV *sv)
|
2220 | 2220 | errmsg("cannot use return_next in a non-SETOF function")));
|
2221 | 2221 |
|
2222 | 2222 | if (prodesc->fn_retistuple &&
|
2223 |
| - !(SvOK(sv) && SvTYPE(sv) == SVt_RV && SvTYPE(SvRV(sv)) == SVt_PVHV)) |
| 2223 | + !(SvOK(sv) && SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVHV)) |
2224 | 2224 | ereport(ERROR,
|
2225 | 2225 | (errcode(ERRCODE_DATATYPE_MISMATCH),
|
2226 | 2226 | errmsg("SETOF-composite-returning PL/Perl function "
|
|
0 commit comments