From d26888bc4d1e539a82f21382b0000fe5bbf889d9 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Thu, 18 Jul 2013 11:52:12 -0400 Subject: Move checking an explicit VARIADIC "any" argument into the parser. This is more efficient and simpler . It does mean that an untyped NULL can no longer be used in such cases, which should be mentioned in Release Notes, but doesn't seem a terrible loss. The workaround is to cast the NULL to some array type. Pavel Stehule, reviewed by Jeevan Chalke. --- src/test/regress/expected/text.out | 10 ++++++---- src/test/regress/sql/text.sql | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/test') diff --git a/src/test/regress/expected/text.out b/src/test/regress/expected/text.out index 4b1c62bf53c..1587046d95a 100644 --- a/src/test/regress/expected/text.out +++ b/src/test/regress/expected/text.out @@ -149,13 +149,13 @@ select concat_ws(',', variadic array[1,2,3]); 1,2,3 (1 row) -select concat_ws(',', variadic NULL); +select concat_ws(',', variadic NULL::int[]); concat_ws ----------- (1 row) -select concat(variadic NULL) is NULL; +select concat(variadic NULL::int[]) is NULL; ?column? ---------- t @@ -170,6 +170,8 @@ select concat(variadic '{}'::int[]) = ''; --should fail select concat_ws(',', variadic 10); ERROR: VARIADIC argument must be an array +LINE 1: select concat_ws(',', variadic 10); + ^ /* * format */ @@ -315,8 +317,8 @@ select format('%2$s, %1$s', variadic array[1, 2]); 2, 1 (1 row) --- variadic argument can be NULL, but should not be referenced -select format('Hello', variadic NULL); +-- variadic argument can be array type NULL, but should not be referenced +select format('Hello', variadic NULL::int[]); format -------- Hello diff --git a/src/test/regress/sql/text.sql b/src/test/regress/sql/text.sql index c4ed74b39d4..60c15b54c0f 100644 --- a/src/test/regress/sql/text.sql +++ b/src/test/regress/sql/text.sql @@ -47,8 +47,8 @@ select quote_literal(e'\\'); -- check variadic labeled argument select concat(variadic array[1,2,3]); select concat_ws(',', variadic array[1,2,3]); -select concat_ws(',', variadic NULL); -select concat(variadic NULL) is NULL; +select concat_ws(',', variadic NULL::int[]); +select concat(variadic NULL::int[]) is NULL; select concat(variadic '{}'::int[]) = ''; --should fail select concat_ws(',', variadic 10); @@ -93,8 +93,8 @@ select format('%s, %s', variadic array[true, false]::text[]); -- check variadic with positional placeholders select format('%2$s, %1$s', variadic array['first', 'second']); select format('%2$s, %1$s', variadic array[1, 2]); --- variadic argument can be NULL, but should not be referenced -select format('Hello', variadic NULL); +-- variadic argument can be array type NULL, but should not be referenced +select format('Hello', variadic NULL::int[]); -- variadic argument allows simulating more than FUNC_MAX_ARGS parameters select format(string_agg('%s',','), variadic array_agg(i)) from generate_series(1,200) g(i); -- cgit v1.2.3