Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 354dba4

Browse files
okbob@github.comCommitfest Bot
okbob@github.com
authored and
Commitfest Bot
committed
set plpgsql.extra_errors to "none"
Purpose of previous commit was to run tests with active strict_expr_check. Now, reset to default and revert all changes from previous commit.
1 parent 09e0543 commit 354dba4

16 files changed

+52
-56
lines changed

contrib/basic_archive/expected/basic_archive.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ DECLARE
1111
loops int := 0;
1212
BEGIN
1313
LOOP
14-
archived := (SELECT count(*) > 0 FROM pg_ls_dir('.', false, false) a
15-
WHERE a ~ '^[0-9A-F]{24}$');
14+
archived := count(*) > 0 FROM pg_ls_dir('.', false, false) a
15+
WHERE a ~ '^[0-9A-F]{24}$';
1616
IF archived OR loops > 120 * 10 THEN EXIT; END IF;
1717
PERFORM pg_sleep(0.1);
1818
loops := loops + 1;

contrib/basic_archive/sql/basic_archive.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ DECLARE
77
loops int := 0;
88
BEGIN
99
LOOP
10-
archived := (SELECT count(*) > 0 FROM pg_ls_dir('.', false, false) a
11-
WHERE a ~ '^[0-9A-F]{24}$');
10+
archived := count(*) > 0 FROM pg_ls_dir('.', false, false) a
11+
WHERE a ~ '^[0-9A-F]{24}$';
1212
IF archived OR loops > 120 * 10 THEN EXIT; END IF;
1313
PERFORM pg_sleep(0.1);
1414
loops := loops + 1;

src/pl/plpgsql/src/expected/plpgsql_array.out

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ do $$ declare a quadarray;
5050
begin a.c1[1].i := 11; raise notice 'a = %, a.c1[1].i = %', a, a.c1[1].i; end$$;
5151
NOTICE: a = ("{""(,11)""}",), a.c1[1].i = 11
5252
do $$ declare a int[];
53-
begin a := (select array_agg(x) from (values(1),(2),(3)) v(x)); raise notice 'a = %', a; end$$;
53+
begin a := array_agg(x) from (values(1),(2),(3)) v(x); raise notice 'a = %', a; end$$;
5454
NOTICE: a = {1,2,3}
5555
do $$ declare a int[] := array[1,2,3];
5656
begin
@@ -64,34 +64,30 @@ end$$;
6464
NOTICE: a = {1,1,2,3,42,3,1,1,2,3,42,3}
6565
create temp table onecol as select array[1,2] as f1;
6666
do $$ declare a int[];
67-
begin a := (select f1 from onecol); raise notice 'a = %', a; end$$;
67+
begin a := f1 from onecol; raise notice 'a = %', a; end$$;
6868
NOTICE: a = {1,2}
6969
do $$ declare a int[];
70-
begin a := (select * from onecol for update); raise notice 'a = %', a; end$$;
70+
begin a := * from onecol for update; raise notice 'a = %', a; end$$;
7171
NOTICE: a = {1,2}
7272
-- error cases:
7373
do $$ declare a int[];
74-
begin a := (select from onecol); raise notice 'a = %', a; end$$;
75-
ERROR: subquery must return only one column
76-
LINE 1: a := (select from onecol)
77-
^
78-
QUERY: a := (select from onecol)
79-
CONTEXT: PL/pgSQL function inline_code_block line 2 at assignment
74+
begin a := from onecol; raise notice 'a = %', a; end$$;
75+
ERROR: assignment source returned 0 columns
76+
CONTEXT: PL/pgSQL assignment "a := from onecol"
77+
PL/pgSQL function inline_code_block line 2 at assignment
8078
do $$ declare a int[];
81-
begin a := (select f1, f1 from onecol); raise notice 'a = %', a; end$$;
82-
ERROR: subquery must return only one column
83-
LINE 1: a := (select f1, f1 from onecol)
84-
^
85-
QUERY: a := (select f1, f1 from onecol)
86-
CONTEXT: PL/pgSQL function inline_code_block line 2 at assignment
79+
begin a := f1, f1 from onecol; raise notice 'a = %', a; end$$;
80+
ERROR: assignment source returned 2 columns
81+
CONTEXT: PL/pgSQL assignment "a := f1, f1 from onecol"
82+
PL/pgSQL function inline_code_block line 2 at assignment
8783
insert into onecol values(array[11]);
8884
do $$ declare a int[];
89-
begin a := (select f1 from onecol); raise notice 'a = %', a; end$$;
90-
ERROR: more than one row returned by a subquery used as an expression
91-
CONTEXT: PL/pgSQL assignment "a := (select f1 from onecol)"
85+
begin a := f1 from onecol; raise notice 'a = %', a; end$$;
86+
ERROR: query returned more than one row
87+
CONTEXT: query: a := f1 from onecol
9288
PL/pgSQL function inline_code_block line 2 at assignment
9389
do $$ declare a int[];
94-
begin a := (select f1 from onecol limit 1); raise notice 'a = %', a; end$$;
90+
begin a := f1 from onecol limit 1; raise notice 'a = %', a; end$$;
9591
NOTICE: a = {1,2}
9692
do $$ declare a real;
9793
begin a[1] := 2; raise notice 'a = %', a; end$$;

src/pl/plpgsql/src/pl_handler.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ bool plpgsql_check_asserts = true;
5353
static char *plpgsql_extra_warnings_string = NULL;
5454
static char *plpgsql_extra_errors_string = NULL;
5555
int plpgsql_extra_warnings;
56-
int plpgsql_extra_errors = PLPGSQL_XCHECK_STRICTEXPRCHECK;
56+
int plpgsql_extra_errors;
5757

5858
/* Hook for plugins */
5959
PLpgSQL_plugin **plpgsql_plugin_ptr = NULL;
@@ -196,7 +196,7 @@ _PG_init(void)
196196
gettext_noop("List of programming constructs that should produce an error."),
197197
NULL,
198198
&plpgsql_extra_errors_string,
199-
"strict_expr_check",
199+
"none",
200200
PGC_USERSET, GUC_LIST_INPUT,
201201
plpgsql_extra_checks_check_hook,
202202
plpgsql_extra_errors_assign_hook,

src/pl/plpgsql/src/sql/plpgsql_array.sql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ do $$ declare a quadarray;
4646
begin a.c1[1].i := 11; raise notice 'a = %, a.c1[1].i = %', a, a.c1[1].i; end$$;
4747

4848
do $$ declare a int[];
49-
begin a := (select array_agg(x) from (values(1),(2),(3)) v(x)); raise notice 'a = %', a; end$$;
49+
begin a := array_agg(x) from (values(1),(2),(3)) v(x); raise notice 'a = %', a; end$$;
5050

5151
do $$ declare a int[] := array[1,2,3];
5252
begin
@@ -61,26 +61,26 @@ end$$;
6161
create temp table onecol as select array[1,2] as f1;
6262

6363
do $$ declare a int[];
64-
begin a := (select f1 from onecol); raise notice 'a = %', a; end$$;
64+
begin a := f1 from onecol; raise notice 'a = %', a; end$$;
6565

6666
do $$ declare a int[];
67-
begin a := (select * from onecol for update); raise notice 'a = %', a; end$$;
67+
begin a := * from onecol for update; raise notice 'a = %', a; end$$;
6868

6969
-- error cases:
7070

7171
do $$ declare a int[];
72-
begin a := (select from onecol); raise notice 'a = %', a; end$$;
72+
begin a := from onecol; raise notice 'a = %', a; end$$;
7373

7474
do $$ declare a int[];
75-
begin a := (select f1, f1 from onecol); raise notice 'a = %', a; end$$;
75+
begin a := f1, f1 from onecol; raise notice 'a = %', a; end$$;
7676

7777
insert into onecol values(array[11]);
7878

7979
do $$ declare a int[];
80-
begin a := (select f1 from onecol); raise notice 'a = %', a; end$$;
80+
begin a := f1 from onecol; raise notice 'a = %', a; end$$;
8181

8282
do $$ declare a int[];
83-
begin a := (select f1 from onecol limit 1); raise notice 'a = %', a; end$$;
83+
begin a := f1 from onecol limit 1; raise notice 'a = %', a; end$$;
8484

8585
do $$ declare a real;
8686
begin a[1] := 2; raise notice 'a = %', a; end$$;

src/test/recovery/t/026_overwrite_contrecord.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
'postgres', q{
3434
DO $$
3535
DECLARE
36-
wal_segsize int := (SELECT setting::int FROM pg_settings WHERE name = 'wal_segment_size');
36+
wal_segsize int := setting::int FROM pg_settings WHERE name = 'wal_segment_size';
3737
remain int;
3838
iters int := 0;
3939
BEGIN
@@ -43,7 +43,7 @@ BEGIN
4343
from generate_series(1, 10) g;
4444
4545
remain := wal_segsize - (pg_current_wal_insert_lsn() - '0/0') % wal_segsize;
46-
IF (SELECT remain < 2 * setting::int from pg_settings where name = 'block_size') THEN
46+
IF remain < 2 * setting::int from pg_settings where name = 'block_size' THEN
4747
RAISE log 'exiting after % iterations, % bytes to end of WAL segment', iters, remain;
4848
EXIT;
4949
END IF;

src/test/regress/expected/alter_table.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2691,7 +2691,7 @@ LANGUAGE plpgsql AS $$
26912691
DECLARE
26922692
v_relfilenode oid;
26932693
BEGIN
2694-
v_relfilenode := (SELECT relfilenode FROM pg_class WHERE oid = p_tablename);
2694+
v_relfilenode := relfilenode FROM pg_class WHERE oid = p_tablename;
26952695

26962696
EXECUTE p_ddl;
26972697

src/test/regress/expected/plancache.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ create temp view v1 as
139139
select 2+2 as f1;
140140
create function cache_test_2() returns int as $$
141141
begin
142-
return (select f1 from v1);
142+
return f1 from v1;
143143
end$$ language plpgsql;
144144
select cache_test_2();
145145
cache_test_2

src/test/regress/expected/plpgsql.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ create trigger tg_room_ad after delete
121121
-- ************************************************************
122122
create function tg_wslot_biu() returns trigger as $$
123123
begin
124-
if (select count(*) = 0 from Room where roomno = new.roomno) then
124+
if count(*) = 0 from Room where roomno = new.roomno then
125125
raise exception 'Room % does not exist', new.roomno;
126126
end if;
127127
return new;
@@ -286,7 +286,7 @@ begin
286286
raise exception ''no manual manipulation of HSlot'';
287287
end if;
288288
if tg_op = ''UPDATE'' and new.hubname != old.hubname then
289-
if (select count(*) > 0 from Hub where name = old.hubname) then
289+
if count(*) > 0 from Hub where name = old.hubname then
290290
raise exception ''no manual manipulation of HSlot'';
291291
end if;
292292
end if;
@@ -942,12 +942,12 @@ begin
942942
return retval || pslot_backlink_view(psrec.slotlink);
943943
end if;
944944
if sltype = ''HS'' then
945-
retval := (select comment from Hub H, HSlot HS
945+
retval := comment from Hub H, HSlot HS
946946
where HS.slotname = psrec.slotlink
947-
and H.name = HS.hubname);
947+
and H.name = HS.hubname;
948948
retval := retval || '' slot '';
949-
retval := (select retval || slotno::text from HSlot
950-
where slotname = psrec.slotlink);
949+
retval := retval || slotno::text from HSlot
950+
where slotname = psrec.slotlink;
951951
return retval;
952952
end if;
953953
return psrec.slotlink;

src/test/regress/expected/stats_ext.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ CREATE STATISTICS tststats.s8 ON a, b FROM tststats.pt;
350350
CREATE STATISTICS tststats.s9 ON a, b FROM tststats.pt1;
351351
DO $$
352352
DECLARE
353-
relname text := (SELECT reltoastrelid::regclass FROM pg_class WHERE oid = 'tststats.t'::regclass);
353+
relname text := reltoastrelid::regclass FROM pg_class WHERE oid = 'tststats.t'::regclass;
354354
BEGIN
355355
EXECUTE 'CREATE STATISTICS tststats.s10 ON a, b FROM ' || relname;
356356
EXCEPTION WHEN wrong_object_type THEN

src/test/regress/expected/transactions.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ select * from xacttest;
543543
rollback;
544544
-- Now the same test with plpgsql (since it depends on SPI which is different)
545545
create or replace function max_xacttest() returns smallint language plpgsql as
546-
'begin return (select max(a) from xacttest); end' stable;
546+
'begin return max(a) from xacttest; end' stable;
547547
begin;
548548
update xacttest set a = max_xacttest() + 10 where a > 0;
549549
select * from xacttest;
@@ -558,7 +558,7 @@ select * from xacttest;
558558

559559
rollback;
560560
create or replace function max_xacttest() returns smallint language plpgsql as
561-
'begin return (select max(a) from xacttest); end' volatile;
561+
'begin return max(a) from xacttest; end' volatile;
562562
begin;
563563
update xacttest set a = max_xacttest() + 10 where a > 0;
564564
select * from xacttest;

src/test/regress/sql/alter_table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,7 @@ LANGUAGE plpgsql AS $$
16781678
DECLARE
16791679
v_relfilenode oid;
16801680
BEGIN
1681-
v_relfilenode := (SELECT relfilenode FROM pg_class WHERE oid = p_tablename);
1681+
v_relfilenode := relfilenode FROM pg_class WHERE oid = p_tablename;
16821682

16831683
EXECUTE p_ddl;
16841684

src/test/regress/sql/plancache.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ create temp view v1 as
8181

8282
create function cache_test_2() returns int as $$
8383
begin
84-
return (select f1 from v1);
84+
return f1 from v1;
8585
end$$ language plpgsql;
8686

8787
select cache_test_2();

src/test/regress/sql/plpgsql.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ create trigger tg_room_ad after delete
161161
-- ************************************************************
162162
create function tg_wslot_biu() returns trigger as $$
163163
begin
164-
if (select count(*) = 0 from Room where roomno = new.roomno) then
164+
if count(*) = 0 from Room where roomno = new.roomno then
165165
raise exception 'Room % does not exist', new.roomno;
166166
end if;
167167
return new;
@@ -348,7 +348,7 @@ begin
348348
raise exception ''no manual manipulation of HSlot'';
349349
end if;
350350
if tg_op = ''UPDATE'' and new.hubname != old.hubname then
351-
if (select count(*) > 0 from Hub where name = old.hubname) then
351+
if count(*) > 0 from Hub where name = old.hubname then
352352
raise exception ''no manual manipulation of HSlot'';
353353
end if;
354354
end if;
@@ -1071,12 +1071,12 @@ begin
10711071
return retval || pslot_backlink_view(psrec.slotlink);
10721072
end if;
10731073
if sltype = ''HS'' then
1074-
retval := (select comment from Hub H, HSlot HS
1074+
retval := comment from Hub H, HSlot HS
10751075
where HS.slotname = psrec.slotlink
1076-
and H.name = HS.hubname);
1076+
and H.name = HS.hubname;
10771077
retval := retval || '' slot '';
1078-
retval := (select retval || slotno::text from HSlot
1079-
where slotname = psrec.slotlink);
1078+
retval := retval || slotno::text from HSlot
1079+
where slotname = psrec.slotlink;
10801080
return retval;
10811081
end if;
10821082
return psrec.slotlink;

src/test/regress/sql/stats_ext.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ CREATE STATISTICS tststats.s8 ON a, b FROM tststats.pt;
223223
CREATE STATISTICS tststats.s9 ON a, b FROM tststats.pt1;
224224
DO $$
225225
DECLARE
226-
relname text := (SELECT reltoastrelid::regclass FROM pg_class WHERE oid = 'tststats.t'::regclass);
226+
relname text := reltoastrelid::regclass FROM pg_class WHERE oid = 'tststats.t'::regclass;
227227
BEGIN
228228
EXECUTE 'CREATE STATISTICS tststats.s10 ON a, b FROM ' || relname;
229229
EXCEPTION WHEN wrong_object_type THEN

src/test/regress/sql/transactions.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,15 @@ rollback;
320320

321321
-- Now the same test with plpgsql (since it depends on SPI which is different)
322322
create or replace function max_xacttest() returns smallint language plpgsql as
323-
'begin return (select max(a) from xacttest); end' stable;
323+
'begin return max(a) from xacttest; end' stable;
324324

325325
begin;
326326
update xacttest set a = max_xacttest() + 10 where a > 0;
327327
select * from xacttest;
328328
rollback;
329329

330330
create or replace function max_xacttest() returns smallint language plpgsql as
331-
'begin return (select max(a) from xacttest); end' volatile;
331+
'begin return max(a) from xacttest; end' volatile;
332332

333333
begin;
334334
update xacttest set a = max_xacttest() + 10 where a > 0;

0 commit comments

Comments
 (0)