aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plpython/sql/plpython_ereport.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/pl/plpython/sql/plpython_ereport.sql')
-rw-r--r--src/pl/plpython/sql/plpython_ereport.sql62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/pl/plpython/sql/plpython_ereport.sql b/src/pl/plpython/sql/plpython_ereport.sql
index 8303e15dcde..19b14c6048b 100644
--- a/src/pl/plpython/sql/plpython_ereport.sql
+++ b/src/pl/plpython/sql/plpython_ereport.sql
@@ -9,11 +9,11 @@ plpy.info('This is message text.',
detail = 'This is detail text',
hint = 'This is hint text.',
sqlstate = 'XX000',
- schema = 'any info about schema',
- table = 'any info about table',
- column = 'any info about column',
- datatype = 'any info about datatype',
- constraint = 'any info about constraint')
+ schema_name = 'any info about schema',
+ table_name = 'any info about table',
+ column_name = 'any info about column',
+ datatype_name = 'any info about datatype',
+ constraint_name = 'any info about constraint')
plpy.notice('notice', detail = 'some detail')
plpy.warning('warning', detail = 'some detail')
plpy.error('stop on error', detail = 'some detail', hint = 'some hint')
@@ -43,12 +43,12 @@ do $$ plpy.info('first message', 'second message', message='third message') $$ L
-- raise exception in python, handle exception in plgsql
CREATE OR REPLACE FUNCTION raise_exception(_message text, _detail text DEFAULT NULL, _hint text DEFAULT NULL,
_sqlstate text DEFAULT NULL,
- _schema text DEFAULT NULL, _table text DEFAULT NULL, _column text DEFAULT NULL,
- _datatype text DEFAULT NULL, _constraint text DEFAULT NULL)
+ _schema_name text DEFAULT NULL, _table_name text DEFAULT NULL, _column_name text DEFAULT NULL,
+ _datatype_name text DEFAULT NULL, _constraint_name text DEFAULT NULL)
RETURNS void AS $$
kwargs = { "message":_message, "detail":_detail, "hint":_hint,
- "sqlstate":_sqlstate, "schema":_schema, "table":_table,
- "column":_column, "datatype":_datatype, "constraint":_constraint }
+ "sqlstate":_sqlstate, "schema_name":_schema_name, "table_name":_table_name,
+ "column_name":_column_name, "datatype_name":_datatype_name, "constraint_name":_constraint_name }
# ignore None values - should work on Python2.3
dict = {}
for k in kwargs:
@@ -63,17 +63,17 @@ SELECT raise_exception(_message => 'message text',
_detail => 'detail text',
_hint => 'hint text',
_sqlstate => 'XX555',
- _schema => 'schema text',
- _table => 'table text',
- _column => 'column text',
- _datatype => 'datatype text',
- _constraint => 'constraint text');
+ _schema_name => 'schema text',
+ _table_name => 'table text',
+ _column_name => 'column text',
+ _datatype_name => 'datatype text',
+ _constraint_name => 'constraint text');
SELECT raise_exception(_message => 'message text',
_hint => 'hint text',
- _schema => 'schema text',
- _column => 'column text',
- _constraint => 'constraint text');
+ _schema_name => 'schema text',
+ _column_name => 'column text',
+ _constraint_name => 'constraint text');
DO $$
DECLARE
@@ -84,19 +84,19 @@ DECLARE
__schema_name text;
__table_name text;
__column_name text;
- __datatype text;
- __constraint text;
+ __datatype_name text;
+ __constraint_name text;
BEGIN
BEGIN
PERFORM raise_exception(_message => 'message text',
_detail => 'detail text',
_hint => 'hint text',
_sqlstate => 'XX555',
- _schema => 'schema text',
- _table => 'table text',
- _column => 'column text',
- _datatype => 'datatype text',
- _constraint => 'constraint text');
+ _schema_name => 'schema text',
+ _table_name => 'table text',
+ _column_name => 'column text',
+ _datatype_name => 'datatype text',
+ _constraint_name => 'constraint text');
EXCEPTION WHEN SQLSTATE 'XX555' THEN
GET STACKED DIAGNOSTICS __message = MESSAGE_TEXT,
__detail = PG_EXCEPTION_DETAIL,
@@ -105,13 +105,13 @@ BEGIN
__schema_name = SCHEMA_NAME,
__table_name = TABLE_NAME,
__column_name = COLUMN_NAME,
- __datatype = PG_DATATYPE_NAME,
- __constraint = CONSTRAINT_NAME;
+ __datatype_name = PG_DATATYPE_NAME,
+ __constraint_name = CONSTRAINT_NAME;
RAISE NOTICE 'handled exception'
USING DETAIL = format('message:(%s), detail:(%s), hint: (%s), sqlstate: (%s), '
- 'schema:(%s), table:(%s), column:(%s), datatype:(%s), constraint:(%s)',
+ 'schema_name:(%s), table_name:(%s), column_name:(%s), datatype_name:(%s), constraint_name:(%s)',
__message, __detail, __hint, __sqlstate, __schema_name,
- __table_name, __column_name, __datatype, __constraint);
+ __table_name, __column_name, __datatype_name, __constraint_name);
END;
END;
$$;
@@ -122,7 +122,7 @@ $$;
do $$
try:
- plpy.execute("select raise_exception(_message => 'my message', _sqlstate => 'XX987', _hint => 'some hint', _table=> 'users_tab', _datatype => 'user_type')")
+ plpy.execute("select raise_exception(_message => 'my message', _sqlstate => 'XX987', _hint => 'some hint', _table_name => 'users_tab', _datatype_name => 'user_type')")
except Exception, e:
plpy.info(e.spidata)
raise e
@@ -130,8 +130,8 @@ $$ LANGUAGE plpythonu;
do $$
try:
- plpy.error(message = 'my message', sqlstate = 'XX987', hint = 'some hint', table = 'users_tab', datatype = 'user_type')
+ plpy.error(message = 'my message', sqlstate = 'XX987', hint = 'some hint', table_name = 'users_tab', datatype_name = 'user_type')
except Exception, e:
- plpy.info('sqlstate: %s, hint: %s, tablename: %s, datatype: %s' % (e.sqlstate, e.hint, e.table_name, e.datatype_name))
+ plpy.info('sqlstate: %s, hint: %s, table_name: %s, datatype_name: %s' % (e.sqlstate, e.hint, e.table_name, e.datatype_name))
raise e
$$ LANGUAGE plpythonu;