You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cb1c19d
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: __fixtures__/plpgsql-generated/generated.json
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -145,6 +145,13 @@
145
145
"plpgsql_deparser_fixes-44.sql": "-- Test 44: Trigger function with no final return (implicit compiler RETURN must not be emitted)\nCREATE FUNCTION test_trigger_no_final_return() RETURNS trigger\nLANGUAGE plpgsql AS $$\nBEGIN\n IF TG_OP = 'INSERT' THEN\n RETURN NEW;\n END IF;\nEND$$",
146
146
"plpgsql_deparser_fixes-45.sql": "-- Test 45: Void function with explicit trailing RETURN (must be preserved)\nCREATE FUNCTION test_void_explicit_return() RETURNS void\nLANGUAGE plpgsql AS $$\nBEGIN\n RAISE NOTICE 'hi';\n RETURN;\nEND$$",
147
147
"plpgsql_deparser_fixes-46.sql": "-- Test 46: Trigger function ending in RETURN NEW (unchanged)\nCREATE FUNCTION test_trigger_return_new() RETURNS trigger\nLANGUAGE plpgsql AS $$\nBEGIN\n NEW.updated_at := now();\n RETURN NEW;\nEND$$",
148
+
"plpgsql_deparser_fixes-47.sql": "-- Test 47: Bound cursor declared with SCROLL (option must stay on the declaration, not OPEN)\nCREATE FUNCTION test_scroll_cursor_decl() RETURNS int\nLANGUAGE plpgsql AS $$\nDECLARE\n c SCROLL CURSOR FOR SELECT id FROM s.t ORDER BY id;\n v int;\nBEGIN\n OPEN c;\n FETCH PRIOR FROM c INTO v;\n CLOSE c;\n RETURN v;\nEND$$",
149
+
"plpgsql_deparser_fixes-48.sql": "-- Test 48: Bound cursor declared with NO SCROLL\nCREATE FUNCTION test_no_scroll_cursor_decl() RETURNS void\nLANGUAGE plpgsql AS $$\nDECLARE\n c NO SCROLL CURSOR FOR SELECT id FROM s.t;\n v int;\nBEGIN\n OPEN c;\n FETCH c INTO v;\n CLOSE c;\nEND$$",
150
+
"plpgsql_deparser_fixes-49.sql": "-- Test 49: Plain bound cursor (OPEN must not gain a SCROLL keyword)\nCREATE FUNCTION test_plain_cursor_open() RETURNS void\nLANGUAGE plpgsql AS $$\nDECLARE\n c CURSOR FOR SELECT id FROM s.t;\n v int;\nBEGIN\n OPEN c;\n FETCH c INTO v;\n CLOSE c;\nEND$$",
151
+
"plpgsql_deparser_fixes-50.sql": "-- Test 50: MOVE with count/expression directions (counts must be preserved)\nCREATE FUNCTION test_move_directions() RETURNS void\nLANGUAGE plpgsql AS $$\nDECLARE\n c SCROLL CURSOR FOR SELECT id FROM s.t ORDER BY id;\nBEGIN\n OPEN c;\n MOVE FORWARD 3 FROM c;\n MOVE BACKWARD 2 FROM c;\n MOVE FORWARD ALL FROM c;\n MOVE BACKWARD ALL FROM c;\n MOVE LAST IN c;\n CLOSE c;\nEND$$",
152
+
"plpgsql_deparser_fixes-51.sql": "-- Test 51: Exception handler with SQLSTATE condition (must emit SQLSTATE 'xxxxx')\nCREATE FUNCTION test_sqlstate_condition() RETURNS int\nLANGUAGE plpgsql AS $$\nBEGIN\n RETURN 1;\nEXCEPTION\n WHEN unique_violation OR SQLSTATE '23503' THEN\n RETURN -1;\n WHEN SQLSTATE 'P0001' THEN\n RETURN -2;\nEND$$",
153
+
"plpgsql_deparser_fixes-52.sql": "-- Test 52: Bare RAISE re-throw inside an exception handler (must stay bare)\nCREATE FUNCTION test_bare_raise_rethrow() RETURNS void\nLANGUAGE plpgsql AS $$\nBEGIN\n PERFORM 1;\nEXCEPTION\n WHEN OTHERS THEN\n RAISE;\nEND$$",
154
+
"plpgsql_deparser_fixes-53.sql": "-- Test 53: Array element and slice assignment (target must not be parenthesized)\nCREATE FUNCTION test_array_element_assignment() RETURNS int[]\nLANGUAGE plpgsql AS $$\nDECLARE\n a int[] := ARRAY[1, 2, 3, 4, 5];\n m int[][] := ARRAY[ARRAY[1, 2], ARRAY[3, 4]];\nBEGIN\n a[2] := 20;\n a[2:3] := ARRAY[9, 9];\n m[1][2] := 42;\n RETURN a;\nEND$$",
148
155
"plpgsql_control-1.sql": "--\n-- Tests for PL/pgSQL control structures\n--\n\n-- integer FOR loop\n\ndo $$\nbegin\n -- basic case\n for i in 1..3 loop\n raise notice '1..3: i = %', i;\n end loop;\n -- with BY, end matches exactly\n for i in 1..10 by 3 loop\n raise notice '1..10 by 3: i = %', i;\n end loop;\n -- with BY, end does not match\n for i in 1..11 by 3 loop\n raise notice '1..11 by 3: i = %', i;\n end loop;\n -- zero iterations\n for i in 1..0 by 3 loop\n raise notice '1..0 by 3: i = %', i;\n end loop;\n -- REVERSE\n for i in reverse 10..0 by 3 loop\n raise notice 'reverse 10..0 by 3: i = %', i;\n end loop;\n -- potential overflow\n for i in 2147483620..2147483647 by 10 loop\n raise notice '2147483620..2147483647 by 10: i = %', i;\n end loop;\n -- potential overflow, reverse direction\n for i in reverse -2147483620..-2147483647 by 10 loop\n raise notice 'reverse -2147483620..-2147483647 by 10: i = %', i;\n end loop;\nend$$",
149
156
"plpgsql_control-2.sql": "-- BY can't be zero or negative\ndo $$\nbegin\n for i in 1..3 by 0 loop\n raise notice '1..3 by 0: i = %', i;\n end loop;\nend$$",
150
157
"plpgsql_control-3.sql": "do $$\nbegin\n for i in 1..3 by -1 loop\n raise notice '1..3 by -1: i = %', i;\n end loop;\nend$$",
0 commit comments