git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 556cbdf)
Extend SQL function tests lightly
Sat, 5 Sep 2020 11:28:05 +0000 (13:28 +0200)
Sat, 5 Sep 2020 11:28:05 +0000 (13:28 +0200)
The basic tests that defined SQL functions didn't actually run the
functions to see if they worked. Add that, and also fix a minor
mistake in a function that was revealed by this. (This is not a
question of test coverage, since there are other places where SQL
functions are run, but it is a bit of a silly test design.)

Discussion: https://www.postgresql.org/message-id/flat/1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com


diff --git a/src/test/regress/expected/create_function_3.out b/src/test/regress/expected/create_function_3.out
index ba260df99607623360b6b4ea8a408fb9f89f1da9..ce508ae1dcc94a2a7067167e0bbd47098a003116 100644 (file)
--- a/src/test/regress/expected/create_function_3.out
+++ b/src/test/regress/expected/create_function_3.out
@@ -17,7 +17,7 @@ SET search_path TO temp_func_test, public;
CREATE FUNCTION functest_A_1(text, date) RETURNS bool LANGUAGE 'sql'
AS 'SELECT 1ドル = ''abcd'' AND 2ドル > ''2001年01月01日''';
CREATE FUNCTION functest_A_2(text[]) RETURNS int LANGUAGE 'sql'
- AS 'SELECT 1ドル[0]::int';
+ AS 'SELECT 1ドル[1]::int';
CREATE FUNCTION functest_A_3() RETURNS bool LANGUAGE 'sql'
AS 'SELECT false';
SELECT proname, prorettype::regtype, proargtypes::regtype[] FROM pg_proc
@@ -31,6 +31,24 @@ SELECT proname, prorettype::regtype, proargtypes::regtype[] FROM pg_proc
functest_a_3 | boolean | {}
(3 rows)
+SELECT functest_A_1('abcd', '2020年01月01日');
+ functest_a_1
+--------------
+ t
+(1 row)
+
+SELECT functest_A_2(ARRAY['1', '2', '3']);
+ functest_a_2
+--------------
+ 1
+(1 row)
+
+SELECT functest_A_3();
+ functest_a_3
+--------------
+ f
+(1 row)
+
--
-- IMMUTABLE | STABLE | VOLATILE
--
diff --git a/src/test/regress/sql/create_function_3.sql b/src/test/regress/sql/create_function_3.sql
index 7a2df0ea8a1bc9cac28d3f70d861fd756514d041..bd108a918fbf0f214e0d88a3955270627cbe0c55 100644 (file)
--- a/src/test/regress/sql/create_function_3.sql
+++ b/src/test/regress/sql/create_function_3.sql
@@ -23,7 +23,7 @@ SET search_path TO temp_func_test, public;
CREATE FUNCTION functest_A_1(text, date) RETURNS bool LANGUAGE 'sql'
AS 'SELECT 1ドル = ''abcd'' AND 2ドル > ''2001年01月01日''';
CREATE FUNCTION functest_A_2(text[]) RETURNS int LANGUAGE 'sql'
- AS 'SELECT 1ドル[0]::int';
+ AS 'SELECT 1ドル[1]::int';
CREATE FUNCTION functest_A_3() RETURNS bool LANGUAGE 'sql'
AS 'SELECT false';
SELECT proname, prorettype::regtype, proargtypes::regtype[] FROM pg_proc
@@ -31,6 +31,10 @@ SELECT proname, prorettype::regtype, proargtypes::regtype[] FROM pg_proc
'functest_A_2'::regproc,
'functest_A_3'::regproc) ORDER BY proname;
+SELECT functest_A_1('abcd', '2020年01月01日');
+SELECT functest_A_2(ARRAY['1', '2', '3']);
+SELECT functest_A_3();
+
--
-- IMMUTABLE | STABLE | VOLATILE
--
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /