Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
80e26caa
Commit
80e26caa
authored
Feb 19, 2009
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wordsmithing for PL/Perl messages
parent
6becfa28
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
19 deletions
+19
-19
src/pl/plperl/expected/plperl.out
src/pl/plperl/expected/plperl.out
+8
-8
src/pl/plperl/plperl.c
src/pl/plperl/plperl.c
+11
-11
No files found.
src/pl/plperl/expected/plperl.out
View file @
80e26caa
...
@@ -121,9 +121,9 @@ CREATE OR REPLACE FUNCTION perl_set() RETURNS SETOF testrowperl AS $$
...
@@ -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"
...
@@ -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 $$
...
@@ -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 P
L/P
erl 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 [
...
@@ -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 P
L/P
erl 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 P
L/P
erl 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 P
L/P
erl 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 [
...
@@ -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}
...
...
src/pl/plperl/plperl.c
View file @
80e26caa
/**********************************************************************
/**********************************************************************
* 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.14
4 2009/01/07 13:44:37 tgl
Exp $
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.14
5 2009/02/19 10:33:17 petere
Exp $
*
*
**********************************************************************/
**********************************************************************/
...
@@ -199,7 +199,7 @@ _PG_init(void)
...
@@ -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)
...
@@ -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
(
"
plp
erl functions cannot return type %s"
,
errmsg
(
"
PL/P
erl functions cannot return type %s"
,
format_type_be
(
proc
->
prorettype
))));
format_type_be
(
proc
->
prorettype
))));
}
}
...
@@ -925,7 +925,7 @@ plperl_validator(PG_FUNCTION_ARGS)
...
@@ -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)
...
@@ -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 P
L/P
erl 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)
...
@@ -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 P
L/P
erl function "
"must return reference to hash"
)));
"must return reference to hash"
)));
}
}
...
@@ -1438,7 +1438,7 @@ plperl_trigger_handler(PG_FUNCTION_ARGS)
...
@@ -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)
...
@@ -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)
...
@@ -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
(
"
plp
erl functions cannot return type %s"
,
errmsg
(
"
PL/P
erl 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)
...
@@ -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)
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment