mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Wordsmithing for PL/Perl messages
This commit is contained in:
@ -121,9 +121,9 @@ CREATE OR REPLACE FUNCTION perl_set() RETURNS SETOF testrowperl AS $$
|
|||||||
];
|
];
|
||||||
$$ LANGUAGE plperl;
|
$$ LANGUAGE plperl;
|
||||||
SELECT perl_set();
|
SELECT perl_set();
|
||||||
ERROR: setof-composite-returning Perl function must call return_next with reference to hash
|
ERROR: SETOF-composite-returning PL/Perl function must call return_next with reference to hash
|
||||||
SELECT * FROM perl_set();
|
SELECT * FROM perl_set();
|
||||||
ERROR: setof-composite-returning Perl function must call return_next with reference to hash
|
ERROR: SETOF-composite-returning PL/Perl function must call return_next with reference to hash
|
||||||
CREATE OR REPLACE FUNCTION perl_set() RETURNS SETOF testrowperl AS $$
|
CREATE OR REPLACE FUNCTION perl_set() RETURNS SETOF testrowperl AS $$
|
||||||
return [
|
return [
|
||||||
{ f1 => 1, f2 => 'Hello', f3 => 'World' },
|
{ f1 => 1, f2 => 'Hello', f3 => 'World' },
|
||||||
@ -209,7 +209,7 @@ ERROR: a column definition list is required for functions returning "record"
|
|||||||
LINE 1: SELECT * FROM perl_record_set();
|
LINE 1: SELECT * FROM perl_record_set();
|
||||||
^
|
^
|
||||||
SELECT * FROM perl_record_set() AS (f1 integer, f2 text, f3 text);
|
SELECT * FROM perl_record_set() AS (f1 integer, f2 text, f3 text);
|
||||||
ERROR: setof-composite-returning Perl function must call return_next with reference to hash
|
ERROR: SETOF-composite-returning PL/Perl function must call return_next with reference to hash
|
||||||
CREATE OR REPLACE FUNCTION perl_record_set() RETURNS SETOF record AS $$
|
CREATE OR REPLACE FUNCTION perl_record_set() RETURNS SETOF record AS $$
|
||||||
return [
|
return [
|
||||||
{ f1 => 1, f2 => 'Hello', f3 => 'World' },
|
{ f1 => 1, f2 => 'Hello', f3 => 'World' },
|
||||||
@ -312,7 +312,7 @@ CREATE OR REPLACE FUNCTION foo_bad() RETURNS footype AS $$
|
|||||||
return 42;
|
return 42;
|
||||||
$$ LANGUAGE plperl;
|
$$ LANGUAGE plperl;
|
||||||
SELECT * FROM foo_bad();
|
SELECT * FROM foo_bad();
|
||||||
ERROR: composite-returning Perl function must return reference to hash
|
ERROR: composite-returning PL/Perl function must return reference to hash
|
||||||
CREATE OR REPLACE FUNCTION foo_bad() RETURNS footype AS $$
|
CREATE OR REPLACE FUNCTION foo_bad() RETURNS footype AS $$
|
||||||
return [
|
return [
|
||||||
[1, 2],
|
[1, 2],
|
||||||
@ -320,17 +320,17 @@ return [
|
|||||||
];
|
];
|
||||||
$$ LANGUAGE plperl;
|
$$ LANGUAGE plperl;
|
||||||
SELECT * FROM foo_bad();
|
SELECT * FROM foo_bad();
|
||||||
ERROR: composite-returning Perl function must return reference to hash
|
ERROR: composite-returning PL/Perl function must return reference to hash
|
||||||
CREATE OR REPLACE FUNCTION foo_set_bad() RETURNS SETOF footype AS $$
|
CREATE OR REPLACE FUNCTION foo_set_bad() RETURNS SETOF footype AS $$
|
||||||
return 42;
|
return 42;
|
||||||
$$ LANGUAGE plperl;
|
$$ LANGUAGE plperl;
|
||||||
SELECT * FROM foo_set_bad();
|
SELECT * FROM foo_set_bad();
|
||||||
ERROR: set-returning Perl function must return reference to array or use return_next
|
ERROR: set-returning PL/Perl function must return reference to array or use return_next
|
||||||
CREATE OR REPLACE FUNCTION foo_set_bad() RETURNS SETOF footype AS $$
|
CREATE OR REPLACE FUNCTION foo_set_bad() RETURNS SETOF footype AS $$
|
||||||
return {y => 3, z => 4};
|
return {y => 3, z => 4};
|
||||||
$$ LANGUAGE plperl;
|
$$ LANGUAGE plperl;
|
||||||
SELECT * FROM foo_set_bad();
|
SELECT * FROM foo_set_bad();
|
||||||
ERROR: set-returning Perl function must return reference to array or use return_next
|
ERROR: set-returning PL/Perl function must return reference to array or use return_next
|
||||||
CREATE OR REPLACE FUNCTION foo_set_bad() RETURNS SETOF footype AS $$
|
CREATE OR REPLACE FUNCTION foo_set_bad() RETURNS SETOF footype AS $$
|
||||||
return [
|
return [
|
||||||
[1, 2],
|
[1, 2],
|
||||||
@ -338,7 +338,7 @@ return [
|
|||||||
];
|
];
|
||||||
$$ LANGUAGE plperl;
|
$$ LANGUAGE plperl;
|
||||||
SELECT * FROM foo_set_bad();
|
SELECT * FROM foo_set_bad();
|
||||||
ERROR: setof-composite-returning Perl function must call return_next with reference to hash
|
ERROR: SETOF-composite-returning PL/Perl function must call return_next with reference to hash
|
||||||
CREATE OR REPLACE FUNCTION foo_set_bad() RETURNS SETOF footype AS $$
|
CREATE OR REPLACE FUNCTION foo_set_bad() RETURNS SETOF footype AS $$
|
||||||
return [
|
return [
|
||||||
{y => 3, z => 4}
|
{y => 3, z => 4}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* plperl.c - perl as a procedural language for PostgreSQL
|
* plperl.c - perl as a procedural language for PostgreSQL
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.144 2009/01/07 13:44:37 tgl Exp $
|
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.145 2009/02/19 10:33:17 petere Exp $
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ _PG_init(void)
|
|||||||
pg_bindtextdomain(TEXTDOMAIN);
|
pg_bindtextdomain(TEXTDOMAIN);
|
||||||
|
|
||||||
DefineCustomBoolVariable("plperl.use_strict",
|
DefineCustomBoolVariable("plperl.use_strict",
|
||||||
gettext_noop("If true, will compile trusted and untrusted perl code in strict mode"),
|
gettext_noop("If true, trusted and untrusted Perl code will be compiled in strict mode."),
|
||||||
NULL,
|
NULL,
|
||||||
&plperl_use_strict,
|
&plperl_use_strict,
|
||||||
false,
|
false,
|
||||||
@ -913,7 +913,7 @@ plperl_validator(PG_FUNCTION_ARGS)
|
|||||||
proc->prorettype != VOIDOID)
|
proc->prorettype != VOIDOID)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("plperl functions cannot return type %s",
|
errmsg("PL/Perl functions cannot return type %s",
|
||||||
format_type_be(proc->prorettype))));
|
format_type_be(proc->prorettype))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,7 +925,7 @@ plperl_validator(PG_FUNCTION_ARGS)
|
|||||||
if (get_typtype(argtypes[i]) == TYPTYPE_PSEUDO)
|
if (get_typtype(argtypes[i]) == TYPTYPE_PSEUDO)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("plperl functions cannot take type %s",
|
errmsg("PL/Perl functions cannot accept type %s",
|
||||||
format_type_be(argtypes[i]))));
|
format_type_be(argtypes[i]))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1280,7 +1280,7 @@ plperl_func_handler(PG_FUNCTION_ARGS)
|
|||||||
{
|
{
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||||
errmsg("set-returning Perl function must return "
|
errmsg("set-returning PL/Perl function must return "
|
||||||
"reference to array or use return_next")));
|
"reference to array or use return_next")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1313,7 +1313,7 @@ plperl_func_handler(PG_FUNCTION_ARGS)
|
|||||||
{
|
{
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||||
errmsg("composite-returning Perl function "
|
errmsg("composite-returning PL/Perl function "
|
||||||
"must return reference to hash")));
|
"must return reference to hash")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1438,7 +1438,7 @@ plperl_trigger_handler(PG_FUNCTION_ARGS)
|
|||||||
{
|
{
|
||||||
ereport(WARNING,
|
ereport(WARNING,
|
||||||
(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
|
(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
|
||||||
errmsg("ignoring modified tuple in DELETE trigger")));
|
errmsg("ignoring modified row in DELETE trigger")));
|
||||||
trv = NULL;
|
trv = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1447,7 +1447,7 @@ plperl_trigger_handler(PG_FUNCTION_ARGS)
|
|||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
|
(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
|
||||||
errmsg("result of Perl trigger function must be undef, "
|
errmsg("result of Perl trigger function must be undef, "
|
||||||
"\"SKIP\" or \"MODIFY\"")));
|
"\"SKIP\", or \"MODIFY\"")));
|
||||||
trv = NULL;
|
trv = NULL;
|
||||||
}
|
}
|
||||||
retval = PointerGetDatum(trv);
|
retval = PointerGetDatum(trv);
|
||||||
@ -1612,7 +1612,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
|
|||||||
free(prodesc);
|
free(prodesc);
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("plperl functions cannot return type %s",
|
errmsg("PL/Perl functions cannot return type %s",
|
||||||
format_type_be(procStruct->prorettype))));
|
format_type_be(procStruct->prorettype))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1659,7 +1659,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
|
|||||||
free(prodesc);
|
free(prodesc);
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("plperl functions cannot take type %s",
|
errmsg("PL/Perl functions cannot accept type %s",
|
||||||
format_type_be(procStruct->proargtypes.values[i]))));
|
format_type_be(procStruct->proargtypes.values[i]))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1902,7 +1902,7 @@ plperl_return_next(SV *sv)
|
|||||||
!(SvOK(sv) && SvTYPE(sv) == SVt_RV && SvTYPE(SvRV(sv)) == SVt_PVHV))
|
!(SvOK(sv) && SvTYPE(sv) == SVt_RV && SvTYPE(SvRV(sv)) == SVt_PVHV))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||||
errmsg("setof-composite-returning Perl function "
|
errmsg("SETOF-composite-returning PL/Perl function "
|
||||||
"must call return_next with reference to hash")));
|
"must call return_next with reference to hash")));
|
||||||
|
|
||||||
if (!current_call_data->ret_tdesc)
|
if (!current_call_data->ret_tdesc)
|
||||||
|
Reference in New Issue
Block a user