remove_skip_first_row.patch
text/x-patch
Filename: remove_skip_first_row.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| src/pl/plpgsql/src/pl_scanner.c | 0 | 13 |
| src/test/regress/expected/domain.out | 3 | 3 |
| src/test/regress/expected/guc.out | 1 | 1 |
| src/test/regress/expected/plancache.out | 2 | 2 |
| src/test/regress/expected/plpgsql.out | 24 | 24 |
*** ./src/pl/plpgsql/src/pl_scanner.c.orig 2010-02-26 03:01:35.000000000 +0100
--- ./src/pl/plpgsql/src/pl_scanner.c 2010-08-01 20:56:35.000000000 +0200
***************
*** 519,537 ****
cur_line_start = scanorig;
cur_line_num = 1;
- /*----------
- * Hack: skip any initial newline, so that in the common coding layout
- * CREATE FUNCTION ... AS $$
- * code body
- * $$ LANGUAGE plpgsql;
- * we will think "line 1" is what the programmer thinks of as line 1.
- *----------
- */
- if (*cur_line_start == '\r')
- cur_line_start++;
- if (*cur_line_start == '\n')
- cur_line_start++;
-
cur_line_end = strchr(cur_line_start, '\n');
}
--- 519,524 ----
*** ./src/test/regress/expected/domain.out.orig 2008-06-11 23:53:49.000000000 +0200
--- ./src/test/regress/expected/domain.out 2010-08-01 20:57:33.000000000 +0200
***************
*** 436,442 ****
end$$ language plpgsql;
select doubledecrement(3); -- fail because of implicit null assignment
ERROR: domain pos_int does not allow null values
! CONTEXT: PL/pgSQL function "doubledecrement" line 2 during statement block local variable initialization
create or replace function doubledecrement(p1 pos_int) returns pos_int as $$
declare v pos_int := 0;
begin
--- 436,442 ----
end$$ language plpgsql;
select doubledecrement(3); -- fail because of implicit null assignment
ERROR: domain pos_int does not allow null values
! CONTEXT: PL/pgSQL function "doubledecrement" line 3 during statement block local variable initialization
create or replace function doubledecrement(p1 pos_int) returns pos_int as $$
declare v pos_int := 0;
begin
***************
*** 444,450 ****
end$$ language plpgsql;
select doubledecrement(3); -- fail at initialization assignment
ERROR: value for domain pos_int violates check constraint "pos_int_check"
! CONTEXT: PL/pgSQL function "doubledecrement" line 2 during statement block local variable initialization
create or replace function doubledecrement(p1 pos_int) returns pos_int as $$
declare v pos_int := 1;
begin
--- 444,450 ----
end$$ language plpgsql;
select doubledecrement(3); -- fail at initialization assignment
ERROR: value for domain pos_int violates check constraint "pos_int_check"
! CONTEXT: PL/pgSQL function "doubledecrement" line 3 during statement block local variable initialization
create or replace function doubledecrement(p1 pos_int) returns pos_int as $$
declare v pos_int := 1;
begin
***************
*** 457,463 ****
ERROR: value for domain pos_int violates check constraint "pos_int_check"
select doubledecrement(1); -- fail at assignment to v
ERROR: value for domain pos_int violates check constraint "pos_int_check"
! CONTEXT: PL/pgSQL function "doubledecrement" line 3 at assignment
select doubledecrement(2); -- fail at return
ERROR: value for domain pos_int violates check constraint "pos_int_check"
CONTEXT: PL/pgSQL function "doubledecrement" while casting return value to function's return type
--- 457,463 ----
ERROR: value for domain pos_int violates check constraint "pos_int_check"
select doubledecrement(1); -- fail at assignment to v
ERROR: value for domain pos_int violates check constraint "pos_int_check"
! CONTEXT: PL/pgSQL function "doubledecrement" line 4 at assignment
select doubledecrement(2); -- fail at return
ERROR: value for domain pos_int violates check constraint "pos_int_check"
CONTEXT: PL/pgSQL function "doubledecrement" while casting return value to function's return type
*** ./src/test/regress/expected/guc.out.orig 2010-02-16 23:34:57.000000000 +0100
--- ./src/test/regress/expected/guc.out 2010-08-01 20:57:31.000000000 +0200
***************
*** 686,692 ****
select myfunc(0);
ERROR: division by zero
CONTEXT: SQL statement "SELECT 1/$1"
! PL/pgSQL function "myfunc" line 3 at PERFORM
select current_setting('work_mem');
current_setting
-----------------
--- 686,692 ----
select myfunc(0);
ERROR: division by zero
CONTEXT: SQL statement "SELECT 1/$1"
! PL/pgSQL function "myfunc" line 4 at PERFORM
select current_setting('work_mem');
current_setting
-----------------
*** ./src/test/regress/expected/plancache.out.orig 2009-01-27 13:40:15.000000000 +0100
--- ./src/test/regress/expected/plancache.out 2010-08-01 20:57:32.000000000 +0200
***************
*** 235,241 ****
select cachebug();
NOTICE: table "temptable" does not exist, skipping
CONTEXT: SQL statement "drop table if exists temptable cascade"
! PL/pgSQL function "cachebug" line 3 at SQL statement
NOTICE: 1
NOTICE: 2
NOTICE: 3
--- 235,241 ----
select cachebug();
NOTICE: table "temptable" does not exist, skipping
CONTEXT: SQL statement "drop table if exists temptable cascade"
! PL/pgSQL function "cachebug" line 4 at SQL statement
NOTICE: 1
NOTICE: 2
NOTICE: 3
***************
*** 247,253 ****
select cachebug();
NOTICE: drop cascades to view vv
CONTEXT: SQL statement "drop table if exists temptable cascade"
! PL/pgSQL function "cachebug" line 3 at SQL statement
NOTICE: 1
NOTICE: 2
NOTICE: 3
--- 247,253 ----
select cachebug();
NOTICE: drop cascades to view vv
CONTEXT: SQL statement "drop table if exists temptable cascade"
! PL/pgSQL function "cachebug" line 4 at SQL statement
NOTICE: 1
NOTICE: 2
NOTICE: 3
*** ./src/test/regress/expected/plpgsql.out.orig 2010-06-25 18:40:13.000000000 +0200
--- ./src/test/regress/expected/plpgsql.out 2010-08-01 20:57:36.000000000 +0200
***************
*** 1518,1533 ****
DETAIL: Key (name)=(PF1_1) already exists.
update PSlot set backlink = 'WS.not.there' where slotname = 'PS.base.a1';
ERROR: WS.not.there does not exist
! CONTEXT: PL/pgSQL function "tg_backlink_a" line 16 at assignment
update PSlot set backlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal backlink beginning with XX
! CONTEXT: PL/pgSQL function "tg_backlink_a" line 16 at assignment
update PSlot set slotlink = 'PS.not.there' where slotname = 'PS.base.a1';
ERROR: PS.not.there does not exist
! CONTEXT: PL/pgSQL function "tg_slotlink_a" line 16 at assignment
update PSlot set slotlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal slotlink beginning with XX
! CONTEXT: PL/pgSQL function "tg_slotlink_a" line 16 at assignment
insert into HSlot values ('HS', 'base.hub1', 1, '');
ERROR: duplicate key value violates unique constraint "hslot_name"
DETAIL: Key (slotname)=(HS.base.hub1.1 ) already exists.
--- 1518,1533 ----
DETAIL: Key (name)=(PF1_1) already exists.
update PSlot set backlink = 'WS.not.there' where slotname = 'PS.base.a1';
ERROR: WS.not.there does not exist
! CONTEXT: PL/pgSQL function "tg_backlink_a" line 17 at assignment
update PSlot set backlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal backlink beginning with XX
! CONTEXT: PL/pgSQL function "tg_backlink_a" line 17 at assignment
update PSlot set slotlink = 'PS.not.there' where slotname = 'PS.base.a1';
ERROR: PS.not.there does not exist
! CONTEXT: PL/pgSQL function "tg_slotlink_a" line 17 at assignment
update PSlot set slotlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal slotlink beginning with XX
! CONTEXT: PL/pgSQL function "tg_slotlink_a" line 17 at assignment
insert into HSlot values ('HS', 'base.hub1', 1, '');
ERROR: duplicate key value violates unique constraint "hslot_name"
DETAIL: Key (slotname)=(HS.base.hub1.1 ) already exists.
***************
*** 2067,2079 ****
select test_variable_storage();
NOTICE: should see this
CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
! PL/pgSQL function "test_variable_storage" line 7 at PERFORM
NOTICE: should see this only if -100 <> 0
CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
! PL/pgSQL function "test_variable_storage" line 7 at PERFORM
NOTICE: should see this only if -100 fits in smallint
CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
! PL/pgSQL function "test_variable_storage" line 7 at PERFORM
test_variable_storage
-----------------------
123456789012
--- 2067,2079 ----
select test_variable_storage();
NOTICE: should see this
CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
! PL/pgSQL function "test_variable_storage" line 8 at PERFORM
NOTICE: should see this only if -100 <> 0
CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
! PL/pgSQL function "test_variable_storage" line 8 at PERFORM
NOTICE: should see this only if -100 fits in smallint
CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
! PL/pgSQL function "test_variable_storage" line 8 at PERFORM
test_variable_storage
-----------------------
123456789012
***************
*** 2302,2308 ****
$$ language plpgsql;
select raise_test1(5);
ERROR: too many parameters specified for RAISE
! CONTEXT: PL/pgSQL function "raise_test1" line 2 at RAISE
create function raise_test2(int) returns int as $$
begin
raise notice 'This message has too few parameters: %, %, %', $1, $1;
--- 2302,2308 ----
$$ language plpgsql;
select raise_test1(5);
ERROR: too many parameters specified for RAISE
! CONTEXT: PL/pgSQL function "raise_test1" line 3 at RAISE
create function raise_test2(int) returns int as $$
begin
raise notice 'This message has too few parameters: %, %, %', $1, $1;
***************
*** 2311,2317 ****
$$ language plpgsql;
select raise_test2(10);
ERROR: too few parameters specified for RAISE
! CONTEXT: PL/pgSQL function "raise_test2" line 2 at RAISE
--
-- reject function definitions that contain malformed SQL queries at
-- compile-time, where possible
--- 2311,2317 ----
$$ language plpgsql;
select raise_test2(10);
ERROR: too few parameters specified for RAISE
! CONTEXT: PL/pgSQL function "raise_test2" line 3 at RAISE
--
-- reject function definitions that contain malformed SQL queries at
-- compile-time, where possible
***************
*** 2424,2430 ****
LINE 1: SELECT sqlstate
^
QUERY: SELECT sqlstate
! CONTEXT: PL/pgSQL function "excpt_test1" line 2 at RAISE
create function excpt_test2() returns void as $$
begin
begin
--- 2424,2430 ----
LINE 1: SELECT sqlstate
^
QUERY: SELECT sqlstate
! CONTEXT: PL/pgSQL function "excpt_test1" line 3 at RAISE
create function excpt_test2() returns void as $$
begin
begin
***************
*** 2439,2445 ****
LINE 1: SELECT sqlstate
^
QUERY: SELECT sqlstate
! CONTEXT: PL/pgSQL function "excpt_test2" line 4 at RAISE
create function excpt_test3() returns void as $$
begin
begin
--- 2439,2445 ----
LINE 1: SELECT sqlstate
^
QUERY: SELECT sqlstate
! CONTEXT: PL/pgSQL function "excpt_test2" line 5 at RAISE
create function excpt_test3() returns void as $$
begin
begin
***************
*** 2821,2827 ****
end$$ language plpgsql;
select footest();
ERROR: query returned more than one row
! CONTEXT: PL/pgSQL function "footest" line 4 at SQL statement
create or replace function footest() returns void as $$
declare x record;
begin
--- 2821,2827 ----
end$$ language plpgsql;
select footest();
ERROR: query returned more than one row
! CONTEXT: PL/pgSQL function "footest" line 5 at SQL statement
create or replace function footest() returns void as $$
declare x record;
begin
***************
*** 2884,2890 ****
end$$ language plpgsql;
select footest();
ERROR: query returned no rows
! CONTEXT: PL/pgSQL function "footest" line 4 at SQL statement
create or replace function footest() returns void as $$
declare x record;
begin
--- 2884,2890 ----
end$$ language plpgsql;
select footest();
ERROR: query returned no rows
! CONTEXT: PL/pgSQL function "footest" line 5 at SQL statement
create or replace function footest() returns void as $$
declare x record;
begin
***************
*** 2894,2900 ****
end$$ language plpgsql;
select footest();
ERROR: query returned more than one row
! CONTEXT: PL/pgSQL function "footest" line 4 at SQL statement
create or replace function footest() returns void as $$
declare x record;
begin
--- 2894,2900 ----
end$$ language plpgsql;
select footest();
ERROR: query returned more than one row
! CONTEXT: PL/pgSQL function "footest" line 5 at SQL statement
create or replace function footest() returns void as $$
declare x record;
begin
***************
*** 2918,2924 ****
end$$ language plpgsql;
select footest();
ERROR: query returned no rows
! CONTEXT: PL/pgSQL function "footest" line 4 at EXECUTE statement
create or replace function footest() returns void as $$
declare x record;
begin
--- 2918,2924 ----
end$$ language plpgsql;
select footest();
ERROR: query returned no rows
! CONTEXT: PL/pgSQL function "footest" line 5 at EXECUTE statement
create or replace function footest() returns void as $$
declare x record;
begin
***************
*** 2928,2934 ****
end$$ language plpgsql;
select footest();
ERROR: query returned more than one row
! CONTEXT: PL/pgSQL function "footest" line 4 at EXECUTE statement
drop function footest();
-- test scrollable cursor support
create function sc_test() returns setof integer as $$
--- 2928,2934 ----
end$$ language plpgsql;
select footest();
ERROR: query returned more than one row
! CONTEXT: PL/pgSQL function "footest" line 5 at EXECUTE statement
drop function footest();
-- test scrollable cursor support
create function sc_test() returns setof integer as $$
***************
*** 2972,2978 ****
select * from sc_test(); -- fails because of NO SCROLL specification
ERROR: cursor can only scan forward
HINT: Declare it with SCROLL option to enable backward scan.
! CONTEXT: PL/pgSQL function "sc_test" line 6 at FETCH
create or replace function sc_test() returns setof integer as $$
declare
c refcursor;
--- 2972,2978 ----
select * from sc_test(); -- fails because of NO SCROLL specification
ERROR: cursor can only scan forward
HINT: Declare it with SCROLL option to enable backward scan.
! CONTEXT: PL/pgSQL function "sc_test" line 7 at FETCH
create or replace function sc_test() returns setof integer as $$
declare
c refcursor;
***************
*** 3559,3565 ****
$$ language plpgsql;
select raise_test();
ERROR: RAISE option already specified: MESSAGE
! CONTEXT: PL/pgSQL function "raise_test" line 2 at RAISE
-- conflict on errcode
create or replace function raise_test() returns void as $$
begin
--- 3559,3565 ----
$$ language plpgsql;
select raise_test();
ERROR: RAISE option already specified: MESSAGE
! CONTEXT: PL/pgSQL function "raise_test" line 3 at RAISE
-- conflict on errcode
create or replace function raise_test() returns void as $$
begin
***************
*** 3568,3574 ****
$$ language plpgsql;
select raise_test();
ERROR: RAISE option already specified: ERRCODE
! CONTEXT: PL/pgSQL function "raise_test" line 2 at RAISE
-- nothing to re-RAISE
create or replace function raise_test() returns void as $$
begin
--- 3568,3574 ----
$$ language plpgsql;
select raise_test();
ERROR: RAISE option already specified: ERRCODE
! CONTEXT: PL/pgSQL function "raise_test" line 3 at RAISE
-- nothing to re-RAISE
create or replace function raise_test() returns void as $$
begin
***************
*** 3639,3645 ****
select case_test(5); -- fails
ERROR: case not found
HINT: CASE statement is missing ELSE part.
! CONTEXT: PL/pgSQL function "case_test" line 4 at CASE
select case_test(8);
case_test
----------------------
--- 3639,3645 ----
select case_test(5); -- fails
ERROR: case not found
HINT: CASE statement is missing ELSE part.
! CONTEXT: PL/pgSQL function "case_test" line 5 at CASE
select case_test(8);
case_test
----------------------
***************
*** 3667,3673 ****
select case_test(13); -- fails
ERROR: case not found
HINT: CASE statement is missing ELSE part.
! CONTEXT: PL/pgSQL function "case_test" line 4 at CASE
create or replace function catch() returns void as $$
begin
raise notice '%', case_test(6);
--- 3667,3673 ----
select case_test(13); -- fails
ERROR: case not found
HINT: CASE statement is missing ELSE part.
! CONTEXT: PL/pgSQL function "case_test" line 5 at CASE
create or replace function catch() returns void as $$
begin
raise notice '%', case_test(6);
***************
*** 3943,3949 ****
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
QUERY: SELECT 'foo\\bar\041baz'
! CONTEXT: PL/pgSQL function "strtest" line 3 at RETURN
strtest
-------------
foo\bar!baz
--- 3943,3949 ----
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
QUERY: SELECT 'foo\\bar\041baz'
! CONTEXT: PL/pgSQL function "strtest" line 4 at RETURN
strtest
-------------
foo\bar!baz
***************
*** 4026,4032 ****
LINE 1: SELECT rtrim(roomno) AS roomno, foo FROM Room ORDER BY roomn...
^
QUERY: SELECT rtrim(roomno) AS roomno, foo FROM Room ORDER BY roomno
! CONTEXT: PL/pgSQL function "inline_code_block" line 3 at FOR over SELECT rows
-- Check variable scoping -- a var is not available in its own or prior
-- default expressions.
create function scope_test() returns int as $$
--- 4026,4032 ----
LINE 1: SELECT rtrim(roomno) AS roomno, foo FROM Room ORDER BY roomn...
^
QUERY: SELECT rtrim(roomno) AS roomno, foo FROM Room ORDER BY roomno
! CONTEXT: PL/pgSQL function "inline_code_block" line 4 at FOR over SELECT rows
-- Check variable scoping -- a var is not available in its own or prior
-- default expressions.
create function scope_test() returns int as $$
***************
*** 4063,4069 ****
^
DETAIL: It could refer to either a PL/pgSQL variable or a table column.
QUERY: select q1,q2 from int8_tbl
! CONTEXT: PL/pgSQL function "conflict_test" line 4 at FOR over SELECT rows
create or replace function conflict_test() returns setof int8_tbl as $$
#variable_conflict use_variable
declare r record;
--- 4063,4069 ----
^
DETAIL: It could refer to either a PL/pgSQL variable or a table column.
QUERY: select q1,q2 from int8_tbl
! CONTEXT: PL/pgSQL function "conflict_test" line 5 at FOR over SELECT rows
create or replace function conflict_test() returns setof int8_tbl as $$
#variable_conflict use_variable
declare r record;