aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2024-10-31 15:53:58 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2024-10-31 16:09:27 -0400
commit89e51abcb2905d6beaa09a7d3603d6882ac27033 (patch)
tree27dba1ec7f0bd023f1bfa5103fbafdf3c0841595 /src/test
parentb82c877e76e2398409e823773413079668cf1881 (diff)
downloadpostgresql-89e51abcb2905d6beaa09a7d3603d6882ac27033.tar.gz
postgresql-89e51abcb2905d6beaa09a7d3603d6882ac27033.zip
Add a parse location field to struct FunctionParameter.
This allows an error cursor to be supplied for a bunch of bad-function-definition errors that previously lacked one, or that cheated a bit by pointing at the contained type name when the error isn't really about that. Bump catversion from an abundance of caution --- I don't think this node type can actually appear in stored views/rules, but better safe than sorry. Jian He and Tom Lane (extracted from a larger patch by Jian, with some additional work by me) Discussion: https://postgr.es/m/CACJufxEmONE3P2En=jopZy1m=cCCUs65M4+1o52MW5og9oaUPA@mail.gmail.com
Diffstat (limited to 'src/test')
-rw-r--r--src/test/modules/test_ddl_deparse/expected/create_type.out2
-rw-r--r--src/test/modules/test_ddl_deparse/expected/opfamily.out4
-rw-r--r--src/test/modules/test_pg_dump/expected/test_pg_dump.out2
-rw-r--r--src/test/regress/expected/create_cast.out2
-rw-r--r--src/test/regress/expected/create_procedure.out4
-rw-r--r--src/test/regress/expected/create_type.out14
-rw-r--r--src/test/regress/expected/equivclass.out4
-rw-r--r--src/test/regress/expected/expressions.out4
-rw-r--r--src/test/regress/expected/float4-misrounded-input.out2
-rw-r--r--src/test/regress/expected/float4.out2
-rw-r--r--src/test/regress/expected/float8.out2
-rw-r--r--src/test/regress/expected/polymorphism.out12
12 files changed, 54 insertions, 0 deletions
diff --git a/src/test/modules/test_ddl_deparse/expected/create_type.out b/src/test/modules/test_ddl_deparse/expected/create_type.out
index dadbc8f7f03..b754455e2b8 100644
--- a/src/test/modules/test_ddl_deparse/expected/create_type.out
+++ b/src/test/modules/test_ddl_deparse/expected/create_type.out
@@ -13,6 +13,8 @@ CREATE FUNCTION text_w_default_out(text_w_default)
AS 'textout'
LANGUAGE internal STABLE STRICT ;
NOTICE: argument type text_w_default is only a shell
+LINE 1: CREATE FUNCTION text_w_default_out(text_w_default)
+ ^
NOTICE: DDL test: type simple, tag CREATE FUNCTION
CREATE TYPE employee_type AS (name TEXT, salary NUMERIC);
NOTICE: DDL test: type simple, tag CREATE TYPE
diff --git a/src/test/modules/test_ddl_deparse/expected/opfamily.out b/src/test/modules/test_ddl_deparse/expected/opfamily.out
index c7e3a23ef70..4e1cc747cb8 100644
--- a/src/test/modules/test_ddl_deparse/expected/opfamily.out
+++ b/src/test/modules/test_ddl_deparse/expected/opfamily.out
@@ -8,6 +8,8 @@ NOTICE: DDL test: type simple, tag CREATE FUNCTION
create function int8alias1out(int8alias1) returns cstring
strict immutable language internal as 'int8out';
NOTICE: argument type int8alias1 is only a shell
+LINE 1: create function int8alias1out(int8alias1) returns cstring
+ ^
NOTICE: DDL test: type simple, tag CREATE FUNCTION
create type int8alias1 (
input = int8alias1in,
@@ -24,6 +26,8 @@ NOTICE: DDL test: type simple, tag CREATE FUNCTION
create function int8alias2out(int8alias2) returns cstring
strict immutable language internal as 'int8out';
NOTICE: argument type int8alias2 is only a shell
+LINE 1: create function int8alias2out(int8alias2) returns cstring
+ ^
NOTICE: DDL test: type simple, tag CREATE FUNCTION
create type int8alias2 (
input = int8alias2in,
diff --git a/src/test/modules/test_pg_dump/expected/test_pg_dump.out b/src/test/modules/test_pg_dump/expected/test_pg_dump.out
index 3536d636d8e..98c9cd481e7 100644
--- a/src/test/modules/test_pg_dump/expected/test_pg_dump.out
+++ b/src/test/modules/test_pg_dump/expected/test_pg_dump.out
@@ -36,6 +36,8 @@ CREATE FUNCTION casttesttype_out(casttesttype)
AS 'textout'
LANGUAGE internal STRICT IMMUTABLE;
NOTICE: argument type casttesttype is only a shell
+LINE 1: CREATE FUNCTION casttesttype_out(casttesttype)
+ ^
CREATE TYPE casttesttype (
internallength = variable,
input = casttesttype_in,
diff --git a/src/test/regress/expected/create_cast.out b/src/test/regress/expected/create_cast.out
index 9a56fe3f0fd..fd4871d94db 100644
--- a/src/test/regress/expected/create_cast.out
+++ b/src/test/regress/expected/create_cast.out
@@ -13,6 +13,8 @@ CREATE FUNCTION casttesttype_out(casttesttype)
AS 'textout'
LANGUAGE internal STRICT IMMUTABLE;
NOTICE: argument type casttesttype is only a shell
+LINE 1: CREATE FUNCTION casttesttype_out(casttesttype)
+ ^
CREATE TYPE casttesttype (
internallength = variable,
input = casttesttype_in,
diff --git a/src/test/regress/expected/create_procedure.out b/src/test/regress/expected/create_procedure.out
index 2177ba35090..45b402e25e7 100644
--- a/src/test/regress/expected/create_procedure.out
+++ b/src/test/regress/expected/create_procedure.out
@@ -401,9 +401,13 @@ LINE 1: CREATE PROCEDURE ptestx() LANGUAGE SQL STRICT AS $$ INSERT I...
CREATE PROCEDURE ptestx(a VARIADIC int[], b OUT int) LANGUAGE SQL
AS $$ SELECT a[1] $$;
ERROR: VARIADIC parameter must be the last parameter
+LINE 1: CREATE PROCEDURE ptestx(a VARIADIC int[], b OUT int) LANGUAG...
+ ^
CREATE PROCEDURE ptestx(a int DEFAULT 42, b OUT int) LANGUAGE SQL
AS $$ SELECT a $$;
ERROR: procedure OUT parameters cannot appear after one with a default value
+LINE 1: CREATE PROCEDURE ptestx(a int DEFAULT 42, b OUT int) LANGUAG...
+ ^
ALTER PROCEDURE ptest1(text) STRICT;
ERROR: invalid attribute in procedure definition
LINE 1: ALTER PROCEDURE ptest1(text) STRICT;
diff --git a/src/test/regress/expected/create_type.out b/src/test/regress/expected/create_type.out
index 7383fcdbb12..5181c4290b4 100644
--- a/src/test/regress/expected/create_type.out
+++ b/src/test/regress/expected/create_type.out
@@ -20,6 +20,8 @@ CREATE FUNCTION widget_out(widget)
AS :'regresslib'
LANGUAGE C STRICT IMMUTABLE;
NOTICE: argument type widget is only a shell
+LINE 1: CREATE FUNCTION widget_out(widget)
+ ^
CREATE FUNCTION int44in(cstring)
RETURNS city_budget
AS :'regresslib'
@@ -31,6 +33,8 @@ CREATE FUNCTION int44out(city_budget)
AS :'regresslib'
LANGUAGE C STRICT IMMUTABLE;
NOTICE: argument type city_budget is only a shell
+LINE 1: CREATE FUNCTION int44out(city_budget)
+ ^
CREATE TYPE widget (
internallength = 24,
input = widget_in,
@@ -75,6 +79,8 @@ CREATE FUNCTION int42_out(int42)
AS 'int4out'
LANGUAGE internal STRICT IMMUTABLE;
NOTICE: argument type int42 is only a shell
+LINE 1: CREATE FUNCTION int42_out(int42)
+ ^
CREATE FUNCTION text_w_default_in(cstring)
RETURNS text_w_default
AS 'textin'
@@ -85,6 +91,8 @@ CREATE FUNCTION text_w_default_out(text_w_default)
AS 'textout'
LANGUAGE internal STRICT IMMUTABLE;
NOTICE: argument type text_w_default is only a shell
+LINE 1: CREATE FUNCTION text_w_default_out(text_w_default)
+ ^
CREATE TYPE int42 (
internallength = 4,
input = int42_in,
@@ -186,6 +194,8 @@ NOTICE: return type base_type is only a shell
CREATE FUNCTION base_fn_out(base_type) RETURNS cstring AS 'boolout'
LANGUAGE internal IMMUTABLE STRICT;
NOTICE: argument type base_type is only a shell
+LINE 1: CREATE FUNCTION base_fn_out(base_type) RETURNS cstring AS 'b...
+ ^
CREATE TYPE base_type(INPUT = base_fn_in, OUTPUT = base_fn_out);
DROP FUNCTION base_fn_in(cstring); -- error
ERROR: cannot drop function base_fn_in(cstring) because other objects depend on it
@@ -320,9 +330,13 @@ NOTICE: return type myvarchar is only a shell
CREATE FUNCTION myvarcharout(myvarchar) RETURNS cstring
LANGUAGE internal IMMUTABLE PARALLEL SAFE STRICT AS 'varcharout';
NOTICE: argument type myvarchar is only a shell
+LINE 1: CREATE FUNCTION myvarcharout(myvarchar) RETURNS cstring
+ ^
CREATE FUNCTION myvarcharsend(myvarchar) RETURNS bytea
LANGUAGE internal STABLE PARALLEL SAFE STRICT AS 'varcharsend';
NOTICE: argument type myvarchar is only a shell
+LINE 1: CREATE FUNCTION myvarcharsend(myvarchar) RETURNS bytea
+ ^
CREATE FUNCTION myvarcharrecv(internal, oid, integer) RETURNS myvarchar
LANGUAGE internal STABLE PARALLEL SAFE STRICT AS 'varcharrecv';
NOTICE: return type myvarchar is only a shell
diff --git a/src/test/regress/expected/equivclass.out b/src/test/regress/expected/equivclass.out
index a328164fe0f..56227505009 100644
--- a/src/test/regress/expected/equivclass.out
+++ b/src/test/regress/expected/equivclass.out
@@ -16,6 +16,8 @@ NOTICE: return type int8alias1 is only a shell
create function int8alias1out(int8alias1) returns cstring
strict immutable language internal as 'int8out';
NOTICE: argument type int8alias1 is only a shell
+LINE 1: create function int8alias1out(int8alias1) returns cstring
+ ^
create type int8alias1 (
input = int8alias1in,
output = int8alias1out,
@@ -28,6 +30,8 @@ NOTICE: return type int8alias2 is only a shell
create function int8alias2out(int8alias2) returns cstring
strict immutable language internal as 'int8out';
NOTICE: argument type int8alias2 is only a shell
+LINE 1: create function int8alias2out(int8alias2) returns cstring
+ ^
create type int8alias2 (
input = int8alias2in,
output = int8alias2out,
diff --git a/src/test/regress/expected/expressions.out b/src/test/regress/expected/expressions.out
index caeeb196740..21c54fc1989 100644
--- a/src/test/regress/expected/expressions.out
+++ b/src/test/regress/expected/expressions.out
@@ -337,9 +337,13 @@ NOTICE: return type myint is only a shell
create function myintout(myint) returns cstring strict immutable language
internal as 'int4out';
NOTICE: argument type myint is only a shell
+LINE 1: create function myintout(myint) returns cstring strict immut...
+ ^
create function myinthash(myint) returns integer strict immutable language
internal as 'hashint4';
NOTICE: argument type myint is only a shell
+LINE 1: create function myinthash(myint) returns integer strict immu...
+ ^
create type myint (input = myintin, output = myintout, like = int4);
create cast (int4 as myint) without function;
create cast (myint as int4) without function;
diff --git a/src/test/regress/expected/float4-misrounded-input.out b/src/test/regress/expected/float4-misrounded-input.out
index a4272316274..20fd7139136 100644
--- a/src/test/regress/expected/float4-misrounded-input.out
+++ b/src/test/regress/expected/float4-misrounded-input.out
@@ -490,6 +490,8 @@ NOTICE: return type xfloat4 is only a shell
create function xfloat4out(xfloat4) returns cstring immutable strict
language internal as 'int4out';
NOTICE: argument type xfloat4 is only a shell
+LINE 1: create function xfloat4out(xfloat4) returns cstring immutabl...
+ ^
create type xfloat4 (input = xfloat4in, output = xfloat4out, like = float4);
create cast (xfloat4 as float4) without function;
create cast (float4 as xfloat4) without function;
diff --git a/src/test/regress/expected/float4.out b/src/test/regress/expected/float4.out
index 65ee82caaee..1d21c4390ad 100644
--- a/src/test/regress/expected/float4.out
+++ b/src/test/regress/expected/float4.out
@@ -490,6 +490,8 @@ NOTICE: return type xfloat4 is only a shell
create function xfloat4out(xfloat4) returns cstring immutable strict
language internal as 'int4out';
NOTICE: argument type xfloat4 is only a shell
+LINE 1: create function xfloat4out(xfloat4) returns cstring immutabl...
+ ^
create type xfloat4 (input = xfloat4in, output = xfloat4out, like = float4);
create cast (xfloat4 as float4) without function;
create cast (float4 as xfloat4) without function;
diff --git a/src/test/regress/expected/float8.out b/src/test/regress/expected/float8.out
index 344d6b7d6d7..de56998f5cd 100644
--- a/src/test/regress/expected/float8.out
+++ b/src/test/regress/expected/float8.out
@@ -1022,6 +1022,8 @@ NOTICE: return type xfloat8 is only a shell
create function xfloat8out(xfloat8) returns cstring immutable strict
language internal as 'int8out';
NOTICE: argument type xfloat8 is only a shell
+LINE 1: create function xfloat8out(xfloat8) returns cstring immutabl...
+ ^
create type xfloat8 (input = xfloat8in, output = xfloat8out, like = float8);
create cast (xfloat8 as float8) without function;
create cast (float8 as xfloat8) without function;
diff --git a/src/test/regress/expected/polymorphism.out b/src/test/regress/expected/polymorphism.out
index bf08e40ed8f..94eedfe375e 100644
--- a/src/test/regress/expected/polymorphism.out
+++ b/src/test/regress/expected/polymorphism.out
@@ -1165,6 +1165,8 @@ create function dfunc(a int = 1, b int) returns int as $$
select $1 + $2;
$$ language sql;
ERROR: input parameters after one with a default value must also have defaults
+LINE 1: create function dfunc(a int = 1, b int) returns int as $$
+ ^
-- however, this should work:
create function dfunc(a int = 1, out sum int, b int = 2) as $$
select $1 + $2;
@@ -1270,6 +1272,8 @@ create function dfunc(out int = 20) returns int as $$
select 1;
$$ language sql;
ERROR: only input parameters can have default values
+LINE 1: create function dfunc(out int = 20) returns int as $$
+ ^
-- polymorphic parameter test
create function dfunc(anyelement = 'World'::text) returns text as $$
select 'Hello, ' || $1::text;
@@ -1567,12 +1571,20 @@ drop function dfunc(varchar, numeric);
--fail, named parameters are not unique
create function testpolym(a int, a int) returns int as $$ select 1;$$ language sql;
ERROR: parameter name "a" used more than once
+LINE 1: create function testpolym(a int, a int) returns int as $$ se...
+ ^
create function testpolym(int, out a int, out a int) returns int as $$ select 1;$$ language sql;
ERROR: parameter name "a" used more than once
+LINE 1: create function testpolym(int, out a int, out a int) returns...
+ ^
create function testpolym(out a int, inout a int) returns int as $$ select 1;$$ language sql;
ERROR: parameter name "a" used more than once
+LINE 1: create function testpolym(out a int, inout a int) returns in...
+ ^
create function testpolym(a int, inout a int) returns int as $$ select 1;$$ language sql;
ERROR: parameter name "a" used more than once
+LINE 1: create function testpolym(a int, inout a int) returns int as...
+ ^
-- valid
create function testpolym(a int, out a int) returns int as $$ select $1;$$ language sql;
select testpolym(37);