mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-12 09:27:04 +08:00
Extend SQL function tests lightly
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
This commit is contained in:
@ -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
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user