mirror of
https://github.com/postgres/postgres.git
synced 2025-12-10 14:22:35 +03:00
Arrange to emit a CONTEXT: SQL function "foo" entry in an error
message that is reporting a prechecking error in a SQL function. This is to cue client-side code that the syntax error position, if any, is with respect to the function body and not the outer command.
This commit is contained in:
@@ -52,16 +52,20 @@ CREATE FUNCTION test1 (int) RETURNS int LANGUAGE sql
|
||||
AS 'SELECT ''not an integer'';';
|
||||
ERROR: return type mismatch in function declared to return integer
|
||||
DETAIL: Actual return type is "unknown".
|
||||
CONTEXT: SQL function "test1"
|
||||
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE sql
|
||||
AS 'not even SQL';
|
||||
ERROR: syntax error at or near "not" at character 1
|
||||
CONTEXT: SQL function "test1"
|
||||
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE sql
|
||||
AS 'SELECT 1, 2, 3;';
|
||||
ERROR: return type mismatch in function declared to return integer
|
||||
DETAIL: Final SELECT must return exactly one column.
|
||||
CONTEXT: SQL function "test1"
|
||||
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE sql
|
||||
AS 'SELECT $2;';
|
||||
ERROR: there is no parameter $2
|
||||
CONTEXT: SQL function "test1"
|
||||
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE sql
|
||||
AS 'a', 'b';
|
||||
ERROR: only one AS item needed for language "sql"
|
||||
|
||||
Reference in New Issue
Block a user