Commit bef47331 authored by Tom Lane's avatar Tom Lane

Code review for plpgsql fn_signature patch.

Don't quote the output of format_procedure(); it's already quoted quite
enough.  Remove the fn_name field, which was now just dead weight.  Fix
remaining expected-output files.
parent 4b77bfc3
......@@ -341,7 +341,6 @@ do_compile(FunctionCallInfo fcinfo,
ALLOCSET_DEFAULT_MAXSIZE);
compile_tmp_cxt = MemoryContextSwitchTo(func_cxt);
function->fn_name = pstrdup(NameStr(procStruct->proname));
function->fn_signature = format_procedure(fcinfo->flinfo->fn_oid);
function->fn_oid = fcinfo->flinfo->fn_oid;
function->fn_xmin = HeapTupleHeaderGetXmin(procTup->t_data);
......@@ -803,7 +802,6 @@ plpgsql_compile_inline(char *proc_source)
ALLOCSET_DEFAULT_MAXSIZE);
compile_tmp_cxt = MemoryContextSwitchTo(func_cxt);
function->fn_name = pstrdup(func_name);
function->fn_signature = pstrdup(func_name);
function->fn_is_trigger = false;
function->fn_input_collation = InvalidOid;
......
......@@ -798,7 +798,7 @@ plpgsql_exec_error_callback(void *arg)
* translator: last %s is a phrase such as "during statement block
* local variable initialization"
*/
errcontext("PL/pgSQL function \"%s\" line %d %s",
errcontext("PL/pgSQL function %s line %d %s",
estate->func->fn_signature,
estate->err_stmt->lineno,
_(estate->err_text));
......@@ -809,7 +809,7 @@ plpgsql_exec_error_callback(void *arg)
* translator: last %s is a phrase such as "while storing call
* arguments into local variables"
*/
errcontext("PL/pgSQL function \"%s\" %s",
errcontext("PL/pgSQL function %s %s",
estate->func->fn_signature,
_(estate->err_text));
}
......@@ -817,13 +817,13 @@ plpgsql_exec_error_callback(void *arg)
else if (estate->err_stmt != NULL)
{
/* translator: last %s is a plpgsql statement type name */
errcontext("PL/pgSQL function \"%s\" line %d at %s",
errcontext("PL/pgSQL function %s line %d at %s",
estate->func->fn_signature,
estate->err_stmt->lineno,
plpgsql_stmt_typename(estate->err_stmt));
}
else
errcontext("PL/pgSQL function \"%s\"",
errcontext("PL/pgSQL function %s",
estate->func->fn_signature);
}
......
......@@ -1461,7 +1461,7 @@ plpgsql_dumptree(PLpgSQL_function *func)
PLpgSQL_datum *d;
printf("\nExecution tree of successfully compiled PL/pgSQL function %s:\n",
func->fn_name);
func->fn_signature);
printf("\nFunction's data area:\n");
for (i = 0; i < func->ndatums; i++)
......@@ -1538,6 +1538,6 @@ plpgsql_dumptree(PLpgSQL_function *func)
dump_indent = 0;
printf("%3d:", func->action->lineno);
dump_block(func->action);
printf("\nEnd of execution tree of function %s\n\n", func->fn_name);
printf("\nEnd of execution tree of function %s\n\n", func->fn_signature);
fflush(stdout);
}
......@@ -678,7 +678,6 @@ typedef struct PLpgSQL_func_hashkey
typedef struct PLpgSQL_function
{ /* Complete compiled function */
char *fn_name;
char *fn_signature;
Oid fn_oid;
TransactionId fn_xmin;
......
......@@ -292,7 +292,7 @@ PL/Python function "python_traceback"
SELECT sql_error();
ERROR: division by zero
CONTEXT: SQL statement "select 1/0"
PL/pgSQL function "sql_error()" line 3 at SQL statement
PL/pgSQL function sql_error() line 3 at SQL statement
SELECT python_from_sql_error();
ERROR: spiexceptions.DivisionByZero: division by zero
CONTEXT: Traceback (most recent call last):
......@@ -306,7 +306,7 @@ CONTEXT: Traceback (most recent call last):
plpy.execute("select sql_error()")
PL/Python function "python_traceback"
SQL statement "select python_traceback()"
PL/pgSQL function "python_from_sql_error()" line 3 at SQL statement
PL/pgSQL function python_from_sql_error() line 3 at SQL statement
SELECT sql_from_python_error();
ERROR: spiexceptions.DivisionByZero: division by zero
CONTEXT: Traceback (most recent call last):
......
......@@ -292,7 +292,7 @@ PL/Python function "python_traceback"
SELECT sql_error();
ERROR: division by zero
CONTEXT: SQL statement "select 1/0"
PL/pgSQL function "sql_error" line 3 at SQL statement
PL/pgSQL function sql_error() line 3 at SQL statement
SELECT python_from_sql_error();
ERROR: spiexceptions.DivisionByZero: division by zero
CONTEXT: Traceback (most recent call last):
......@@ -306,7 +306,7 @@ CONTEXT: Traceback (most recent call last):
plpy.execute("select sql_error()")
PL/Python function "python_traceback"
SQL statement "select python_traceback()"
PL/pgSQL function "python_from_sql_error" line 3 at SQL statement
PL/pgSQL function python_from_sql_error() line 3 at SQL statement
SELECT sql_from_python_error();
ERROR: spiexceptions.DivisionByZero: division by zero
CONTEXT: Traceback (most recent call last):
......
......@@ -493,7 +493,7 @@ begin
end$$ language plpgsql;
select doubledecrement(3); -- fail because of implicit null assignment
ERROR: domain pos_int does not allow null values
CONTEXT: PL/pgSQL function "doubledecrement(pos_int)" line 3 during statement block local variable initialization
CONTEXT: PL/pgSQL function doubledecrement(pos_int) line 3 during statement block local variable initialization
create or replace function doubledecrement(p1 pos_int) returns pos_int as $$
declare v pos_int := 0;
begin
......@@ -501,7 +501,7 @@ begin
end$$ language plpgsql;
select doubledecrement(3); -- fail at initialization assignment
ERROR: value for domain pos_int violates check constraint "pos_int_check"
CONTEXT: PL/pgSQL function "doubledecrement(pos_int)" line 3 during statement block local variable initialization
CONTEXT: PL/pgSQL function doubledecrement(pos_int) line 3 during statement block local variable initialization
create or replace function doubledecrement(p1 pos_int) returns pos_int as $$
declare v pos_int := 1;
begin
......@@ -514,10 +514,10 @@ select doubledecrement(0); -- fail before call
ERROR: value for domain pos_int violates check constraint "pos_int_check"
select doubledecrement(1); -- fail at assignment to v
ERROR: value for domain pos_int violates check constraint "pos_int_check"
CONTEXT: PL/pgSQL function "doubledecrement(pos_int)" line 4 at assignment
CONTEXT: PL/pgSQL function doubledecrement(pos_int) line 4 at assignment
select doubledecrement(2); -- fail at return
ERROR: value for domain pos_int violates check constraint "pos_int_check"
CONTEXT: PL/pgSQL function "doubledecrement(pos_int)" while casting return value to function's return type
CONTEXT: PL/pgSQL function doubledecrement(pos_int) while casting return value to function's return type
select doubledecrement(3); -- good
doubledecrement
-----------------
......@@ -566,7 +566,7 @@ end$$ language plpgsql;
select array_elem_check(121.00);
ERROR: numeric field overflow
DETAIL: A field with precision 4, scale 2 must round to an absolute value less than 10^2.
CONTEXT: PL/pgSQL function "array_elem_check(numeric)" line 5 at assignment
CONTEXT: PL/pgSQL function array_elem_check(numeric) line 5 at assignment
select array_elem_check(1.23456);
array_elem_check
------------------
......@@ -584,7 +584,7 @@ end$$ language plpgsql;
select array_elem_check(121.00);
ERROR: numeric field overflow
DETAIL: A field with precision 4, scale 2 must round to an absolute value less than 10^2.
CONTEXT: PL/pgSQL function "array_elem_check(numeric)" line 5 at assignment
CONTEXT: PL/pgSQL function array_elem_check(numeric) line 5 at assignment
select array_elem_check(1.23456);
array_elem_check
------------------
......@@ -602,7 +602,7 @@ end$$ language plpgsql;
select array_elem_check(121.00);
ERROR: numeric field overflow
DETAIL: A field with precision 4, scale 2 must round to an absolute value less than 10^2.
CONTEXT: PL/pgSQL function "array_elem_check(numeric)" line 5 at assignment
CONTEXT: PL/pgSQL function array_elem_check(numeric) line 5 at assignment
select array_elem_check(1.23456);
array_elem_check
------------------
......@@ -650,7 +650,7 @@ select array_elem_check(3);
select array_elem_check(-1);
ERROR: value for domain orderedpair violates check constraint "orderedpair_check"
CONTEXT: PL/pgSQL function "array_elem_check(integer)" line 5 at assignment
CONTEXT: PL/pgSQL function array_elem_check(integer) line 5 at assignment
drop function array_elem_check(int);
--
-- Renaming
......
......@@ -687,7 +687,7 @@ set work_mem = '1MB';
select myfunc(0);
ERROR: division by zero
CONTEXT: SQL statement "SELECT 1/$1"
PL/pgSQL function "myfunc(integer)" line 4 at PERFORM
PL/pgSQL function myfunc(integer) line 4 at PERFORM
select current_setting('work_mem');
current_setting
-----------------
......
......@@ -235,7 +235,7 @@ end$$ language plpgsql;
select cachebug();
NOTICE: table "temptable" does not exist, skipping
CONTEXT: SQL statement "drop table if exists temptable cascade"
PL/pgSQL function "cachebug()" line 4 at SQL statement
PL/pgSQL function cachebug() line 4 at SQL statement
NOTICE: 1
NOTICE: 2
NOTICE: 3
......@@ -247,7 +247,7 @@ NOTICE: 3
select cachebug();
NOTICE: drop cascades to view vv
CONTEXT: SQL statement "drop table if exists temptable cascade"
PL/pgSQL function "cachebug()" line 4 at SQL statement
PL/pgSQL function cachebug() line 4 at SQL statement
NOTICE: 1
NOTICE: 2
NOTICE: 3
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment