summaryrefslogtreecommitdiff
path: root/src/pl/plpython/sql/plpython_error.sql
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2011-02-01 22:53:40 +0200
committerPeter Eisentraut <peter_e@gmx.net>2011-02-01 22:55:04 +0200
commit15f55cc38a82dfa3d7898a7c30a303b1b3e87dc3 (patch)
tree93c0288b58100cc7a6feca3ef1d8031df1873dd2 /src/pl/plpython/sql/plpython_error.sql
parent6c6e6f7fd3ffa984a202b910ef3237e26f9d3c2e (diff)
Add validator to PL/Python
Jan UrbaƄski, reviewed by Hitoshi Harada
Diffstat (limited to 'src/pl/plpython/sql/plpython_error.sql')
-rw-r--r--src/pl/plpython/sql/plpython_error.sql23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/pl/plpython/sql/plpython_error.sql b/src/pl/plpython/sql/plpython_error.sql
index 5ca68495be0..6509257b24d 100644
--- a/src/pl/plpython/sql/plpython_error.sql
+++ b/src/pl/plpython/sql/plpython_error.sql
@@ -2,6 +2,29 @@
-- 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;
+
+/* 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();
+/* Run the function twice to check if the hashtable entry gets cleaned up */
+SELECT python_syntax_error();
+
+RESET check_function_bodies;
+
/* Flat out syntax error
*/
CREATE FUNCTION sql_syntax_error() RETURNS text