diff --git a/src/test/regress/expected/try_convert.out b/src/test/regress/expected/try_convert.out new file mode 100644 index 0000000000..97851e5c74 --- /dev/null +++ b/src/test/regress/expected/try_convert.out @@ -0,0 +1,33 @@ +create schema tryconvert; +set search_path = tryconvert; +-- start_ignore +CREATE EXTENSION IF NOT EXISTS try_convert; +-- end_ignore +-- not date +select try_convert('12', '2002-10-26'::date); + try_convert +------------- + +(1 row) + +-- not int +select try_convert('11/11/20111', 0::int); + try_convert +------------- + +(1 row) + +select try_convert('111d', 0::int); + try_convert +------------- + +(1 row) + +-- to big for int2 +select try_convert('112344466343', 0::int2); + try_convert +------------- + +(1 row) + +reset search_path; diff --git a/src/test/regress/sql/try_convert.sql b/src/test/regress/sql/try_convert.sql index 36f8134623..91a06724a8 100644 --- a/src/test/regress/sql/try_convert.sql +++ b/src/test/regress/sql/try_convert.sql @@ -5,19 +5,14 @@ set search_path = tryconvert; CREATE EXTENSION IF NOT EXISTS try_convert; -- end_ignore --- no way to convert -select try_convert(12::text, NULL::date); +-- not date +select try_convert('12', '2002-10-26'::date); --- typecast via I/O -select try_convert('11/11/20111', NULL::int); -select try_convert('111d', NULL::int); +-- not int +select try_convert('11/11/20111', 0::int); +select try_convert('111d', 0::int); --- typecast from pg_proc -select try_convert('112344466343', NULL::int4); - --- arrays -select try_convert('{1, 2, 31111111111}', NULL::int4[]); -- pg_proc -select try_convert('{1, 2, lol}', NULL::int4[]); -- via I/O -select try_convert('{1, 2, 31111111111}', NULL::int4[]); -- +-- to big for int2 +select try_convert('112344466343', 0::int2); reset search_path; \ No newline at end of file