mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-08 20:57:40 +08:00
Add validator to PL/Python
Jan Urbański, reviewed by Hitoshi Harada
This commit is contained in:
@ -1,6 +1,30 @@
|
||||
-- test error handling, i forgot to restore Warn_restart in
|
||||
-- the trigger handler once. the errors and subsequent core dump were
|
||||
-- interesting.
|
||||
/* Flat out Python syntax error
|
||||
*/
|
||||
CREATE FUNCTION python_syntax_error() RETURNS text
|
||||
AS
|
||||
'.syntaxerror'
|
||||
LANGUAGE plpythonu;
|
||||
ERROR: could not compile PL/Python function "python_syntax_error"
|
||||
DETAIL: SyntaxError: invalid syntax (<string>, line 2)
|
||||
/* With check_function_bodies = false the function should get defined
|
||||
* and the error reported when called
|
||||
*/
|
||||
SET check_function_bodies = false;
|
||||
CREATE FUNCTION python_syntax_error() RETURNS text
|
||||
AS
|
||||
'.syntaxerror'
|
||||
LANGUAGE plpythonu;
|
||||
SELECT python_syntax_error();
|
||||
ERROR: could not compile PL/Python function "python_syntax_error"
|
||||
DETAIL: SyntaxError: invalid syntax (<string>, line 2)
|
||||
/* Run the function twice to check if the hashtable entry gets cleaned up */
|
||||
SELECT python_syntax_error();
|
||||
ERROR: could not compile PL/Python function "python_syntax_error"
|
||||
DETAIL: SyntaxError: invalid syntax (<string>, line 2)
|
||||
RESET check_function_bodies;
|
||||
/* Flat out syntax error
|
||||
*/
|
||||
CREATE FUNCTION sql_syntax_error() RETURNS text
|
||||
|
||||
Reference in New Issue
Block a user