mirror of https://github.com/postgres/postgres
The plpgsql.sql test file in the main regression tests is now by far the largest after numeric_big, making editing and managing the test cases very cumbersome. The other PLs have their own test suites split up into smaller files by topic. It would be nice to have that for plpgsql as well. So, to get that started, set up test infrastructure in src/pl/plpgsql/src/ and split out the recently added procedure test cases into a new file there. That file now mirrors the test cases added to the other PLs, making managing those matching tests a bit easier too. msvc build system changes with help from Michael Paquierpull/27/head
parent
3d8874224f
commit
632b03da31
@ -1,3 +1,6 @@ |
||||
/pl_gram.c |
||||
/pl_gram.h |
||||
/plerrcodes.h |
||||
/log/ |
||||
/results/ |
||||
/tmp_check/ |
||||
|
@ -0,0 +1,41 @@ |
||||
-- |
||||
-- Tests for procedures / CALL syntax |
||||
-- |
||||
CREATE PROCEDURE test_proc1() |
||||
LANGUAGE plpgsql |
||||
AS $$ |
||||
BEGIN |
||||
NULL; |
||||
END; |
||||
$$; |
||||
CALL test_proc1(); |
||||
-- error: can't return non-NULL |
||||
CREATE PROCEDURE test_proc2() |
||||
LANGUAGE plpgsql |
||||
AS $$ |
||||
BEGIN |
||||
RETURN 5; |
||||
END; |
||||
$$; |
||||
CALL test_proc2(); |
||||
ERROR: cannot return a value from a procedure |
||||
CONTEXT: PL/pgSQL function test_proc2() while casting return value to function's return type |
||||
CREATE TABLE test1 (a int); |
||||
CREATE PROCEDURE test_proc3(x int) |
||||
LANGUAGE plpgsql |
||||
AS $$ |
||||
BEGIN |
||||
INSERT INTO test1 VALUES (x); |
||||
END; |
||||
$$; |
||||
CALL test_proc3(55); |
||||
SELECT * FROM test1; |
||||
a |
||||
---- |
||||
55 |
||||
(1 row) |
||||
|
||||
DROP PROCEDURE test_proc1; |
||||
DROP PROCEDURE test_proc2; |
||||
DROP PROCEDURE test_proc3; |
||||
DROP TABLE test1; |
@ -0,0 +1,47 @@ |
||||
-- |
||||
-- Tests for procedures / CALL syntax |
||||
-- |
||||
|
||||
CREATE PROCEDURE test_proc1() |
||||
LANGUAGE plpgsql |
||||
AS $$ |
||||
BEGIN |
||||
NULL; |
||||
END; |
||||
$$; |
||||
|
||||
CALL test_proc1(); |
||||
|
||||
|
||||
-- error: can't return non-NULL |
||||
CREATE PROCEDURE test_proc2() |
||||
LANGUAGE plpgsql |
||||
AS $$ |
||||
BEGIN |
||||
RETURN 5; |
||||
END; |
||||
$$; |
||||
|
||||
CALL test_proc2(); |
||||
|
||||
|
||||
CREATE TABLE test1 (a int); |
||||
|
||||
CREATE PROCEDURE test_proc3(x int) |
||||
LANGUAGE plpgsql |
||||
AS $$ |
||||
BEGIN |
||||
INSERT INTO test1 VALUES (x); |
||||
END; |
||||
$$; |
||||
|
||||
CALL test_proc3(55); |
||||
|
||||
SELECT * FROM test1; |
||||
|
||||
|
||||
DROP PROCEDURE test_proc1; |
||||
DROP PROCEDURE test_proc2; |
||||
DROP PROCEDURE test_proc3; |
||||
|
||||
DROP TABLE test1; |
Loading…
Reference in new issue