pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Difference in postgres9.0.4 and postgres9.1beta1 when displaying error lines in functions with comments
4+ messages / 2 participants
[nested] [flat]

* Difference in postgres9.0.4 and postgres9.1beta1 when displaying error lines in functions with comments
@ 2011-06-10 01:58  Abel Abraham Camarillo Ojeda <acamari@verlet.org>
  0 siblings, 2 replies; 4+ messages in thread

From: Abel Abraham Camarillo Ojeda @ 2011-06-10 01:58 UTC (permalink / raw)
  To: pgsql-hackers@postgresql.org

Postgres 9.0.4 and postgres9.1beta1 give different line of error numbers on
functions that raise runtime errors (it seems).

How to reproduce, given the next SQL file:

$ cat /tmp/sql
begin;
CREATE FUNCTION pg_temp.commchecksql() returns boolean strict language
plpgsql as
$$
begin

-- SQL comment
perform 'aoeuaoeuaeou'::regclass;
return true;
end;
$$;

select pg_temp.commchecksql();
rollback;

begin;
CREATE FUNCTION pg_temp.commcheckC() returns boolean strict language plpgsql as
$$
begin

/* C-like comment */
perform 'aoeuaoeuaeou'::regclass;
return true;
end;
$$;

select pg_temp.commcheckC();

rollback;

------------------

If I run it on postgres9.0.4:

$ psql -U postgres template1 -f/tmp/sql
SET
BEGIN
CREATE FUNCTION
psql:/tmp/sql:12: ERROR:  relation "aoeuaoeuaeou" does not exist
LINE 1: SELECT 'aoeuaoeuaeou'::regclass
               ^
QUERY:  SELECT 'aoeuaoeuaeou'::regclass
CONTEXT:  PL/pgSQL function "commchecksql" line 4 at PERFORM
ROLLBACK
BEGIN
CREATE FUNCTION
psql:/tmp/sql:26: ERROR:  relation "aoeuaoeuaeou" does not exist
LINE 1: SELECT 'aoeuaoeuaeou'::regclass
               ^
QUERY:  SELECT 'aoeuaoeuaeou'::regclass
CONTEXT:  PL/pgSQL function "commcheckc" line 4 at PERFORM
ROLLBACK

--------------------

On postgres9.1beta1:

$ psql -U postgres template1 -f/tmp/sql

SET
BEGIN
CREATE FUNCTION
psql:/tmp/sql:12: ERROR:  relation "aoeuaoeuaeou" does not exist
LINE 1: SELECT 'aoeuaoeuaeou'::regclass
               ^
QUERY:  SELECT 'aoeuaoeuaeou'::regclass
CONTEXT:  PL/pgSQL function "commchecksql" line 5 at PERFORM
ROLLBACK
BEGIN
CREATE FUNCTION
psql:/tmp/sql:26: ERROR:  relation "aoeuaoeuaeou" does not exist
LINE 1: SELECT 'aoeuaoeuaeou'::regclass
               ^
QUERY:  SELECT 'aoeuaoeuaeou'::regclass
CONTEXT:  PL/pgSQL function "commcheckc" line 5 at PERFORM
ROLLBACK

--------------------

The line numbers of where the error is have changed:

inline patch 1: /tmp/out9.1beta1 (+2/-2 lines) download inline-1.patch--- /tmp/out9.0.4 Thu Jun 9 20:47:45 2011 +++ /tmp/out9.1beta1 Thu Jun 9 20:49:02 2011 @@ -5,7 +5,7 @@ LINE 1: SELECT 'aoeuaoeuaeou'::regclass ^ QUERY: SELECT 'aoeuaoeuaeou'::regclass -CONTEXT: PL/pgSQL function "commchecksql" line 4 at PERFORM +CONTEXT: PL/pgSQL function "commchecksql" line 5 at PERFORM ROLLBACK BEGIN CREATE FUNCTION @@ -13,5 +13,5 @@ LINE 1: SELECT 'aoeuaoeuaeou'::regclass ^ QUERY: SELECT 'aoeuaoeuaeou'::regclass -CONTEXT: PL/pgSQL function "commcheckc" line 4 at PERFORM +CONTEXT: PL/pgSQL function "commcheckc" line 5 at PERFORM ROLLBACK
--------------------- I care about this because I have some custom regression tests that check the failing of functions coded like this... and they suddenly failed with that difference when I checked them against postgres9.0.4. Is this an intended behaviour? Thank you. ^ permalink raw reply [nested|flat] 4+ messages in thread

* Fwd: Difference in postgres9.0.4 and postgres9.1beta1 when displaying error lines in functions with comments
@ 2011-06-10 02:17  Abel Abraham Camarillo Ojeda <acamari@verlet.org>
  parent: Abel Abraham Camarillo Ojeda <acamari@verlet.org>
  1 sibling, 0 replies; 4+ messages in thread

From: Abel Abraham Camarillo Ojeda @ 2011-06-10 02:17 UTC (permalink / raw)
  To: pgsql-bugs

I should have posted this here before sending it to pgsql-hackers... ups.

---------- Forwarded message ----------
From: Abel Abraham Camarillo Ojeda <acamari@verlet.org>
Date: Thu, Jun 9, 2011 at 8:58 PM
Subject: Difference in postgres9.0.4 and postgres9.1beta1 when
displaying error lines in functions with comments
To: pgsql-hackers@postgresql.org


Postgres 9.0.4 and postgres9.1beta1 give different line of error numbers on
functions that raise runtime errors (it seems).

How to reproduce, given the next SQL file:

$ cat /tmp/sql
begin;
CREATE FUNCTION pg_temp.commchecksql() returns boolean strict language
plpgsql as
$$
begin

-- SQL comment
perform 'aoeuaoeuaeou'::regclass;
return true;
end;
$$;

select pg_temp.commchecksql();
rollback;

begin;
CREATE FUNCTION pg_temp.commcheckC() returns boolean strict language plpgsql as
$$
begin

/* C-like comment */
perform 'aoeuaoeuaeou'::regclass;
return true;
end;
$$;

select pg_temp.commcheckC();

rollback;

------------------

If I run it on postgres9.0.4:

$ psql -U postgres template1 -f/tmp/sql
SET
BEGIN
CREATE FUNCTION
psql:/tmp/sql:12: ERROR:  relation "aoeuaoeuaeou" does not exist
LINE 1: SELECT 'aoeuaoeuaeou'::regclass
              ^
QUERY:  SELECT 'aoeuaoeuaeou'::regclass
CONTEXT:  PL/pgSQL function "commchecksql" line 4 at PERFORM
ROLLBACK
BEGIN
CREATE FUNCTION
psql:/tmp/sql:26: ERROR:  relation "aoeuaoeuaeou" does not exist
LINE 1: SELECT 'aoeuaoeuaeou'::regclass
              ^
QUERY:  SELECT 'aoeuaoeuaeou'::regclass
CONTEXT:  PL/pgSQL function "commcheckc" line 4 at PERFORM
ROLLBACK

--------------------

On postgres9.1beta1:

$ psql -U postgres template1 -f/tmp/sql

SET
BEGIN
CREATE FUNCTION
psql:/tmp/sql:12: ERROR:  relation "aoeuaoeuaeou" does not exist
LINE 1: SELECT 'aoeuaoeuaeou'::regclass
              ^
QUERY:  SELECT 'aoeuaoeuaeou'::regclass
CONTEXT:  PL/pgSQL function "commchecksql" line 5 at PERFORM
ROLLBACK
BEGIN
CREATE FUNCTION
psql:/tmp/sql:26: ERROR:  relation "aoeuaoeuaeou" does not exist
LINE 1: SELECT 'aoeuaoeuaeou'::regclass
              ^
QUERY:  SELECT 'aoeuaoeuaeou'::regclass
CONTEXT:  PL/pgSQL function "commcheckc" line 5 at PERFORM
ROLLBACK

--------------------

The line numbers of where the error is have changed:

inline patch 1: /tmp/out9.1beta1    Thu Jun  9 20:49:02 2011 (+0/-0 lines) download inline-1.patch--- /tmp/out9.0.4       Thu Jun  9 20:47:45 2011 +++ /tmp/out9.1beta1    Thu Jun  9 20:49:02 2011 @@ -5,7 +5,7 @@
 LINE 1: SELECT 'aoeuaoeuaeou'::regclass                ^  QUERY:  SELECT 'aoeuaoeuaeou'::regclass -CONTEXT:  PL/pgSQL function "commchecksql" line 4 at PERFORM +CONTEXT:  PL/pgSQL function "commchecksql" line 5 at PERFORM  ROLLBACK  BEGIN  CREATE FUNCTION @@ -13,5 +13,5 @@  LINE 1: SELECT 'aoeuaoeuaeou'::regclass                ^  QUERY:  SELECT 'aoeuaoeuaeou'::regclass -CONTEXT:  PL/pgSQL function "commcheckc" line 4 at PERFORM +CONTEXT:  PL/pgSQL function "commcheckc" line 5 at PERFORM  ROLLBACK --------------------- I care about this because I have some custom regression tests that check the failing of functions coded like this... and they suddenly failed with that difference when I checked them against postgres9.0.4. Is this an intended behaviour? Thank you. ^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: Difference in postgres9.0.4 and postgres9.1beta1 when displaying error lines in functions with comments
@ 2011-06-10 02:22  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Abel Abraham Camarillo Ojeda <acamari@verlet.org>
  1 sibling, 1 reply; 4+ messages in thread

From: Tom Lane @ 2011-06-10 02:22 UTC (permalink / raw)
  To: Abel Abraham Camarillo Ojeda <acamari@verlet.org>; +Cc: pgsql-hackers@postgresql.org

Abel Abraham Camarillo Ojeda <acamari@verlet.org> writes:
> Postgres 9.0.4 and postgres9.1beta1 give different line of error numbers on
> functions that raise runtime errors (it seems).

This is not a bug.  See the release notes:

	Adjust PL/pgSQL's error line numbering code to be consistent
	with other PLs (Pavel Stehule)

	Previously, PL/pgSQL would ignore (not count) an empty line at
	the start of the function body. Since this was inconsistent with
	all other languages, the special case was removed.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Difference in postgres9.0.4 and postgres9.1beta1 when displaying error lines in functions with comments
@ 2011-06-10 02:23  Abel Abraham Camarillo Ojeda <acamari@verlet.org>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Abel Abraham Camarillo Ojeda @ 2011-06-10 02:23 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-hackers@postgresql.org

Thanks... and sorry for sending it to hackers list... I had not read the bug
reporting guides... nor the release notes... it seems.

Again, thanks.

On Thu, Jun 9, 2011 at 9:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Abel Abraham Camarillo Ojeda <acamari@verlet.org> writes:
>> Postgres 9.0.4 and postgres9.1beta1 give different line of error numbers on
>> functions that raise runtime errors (it seems).
>
> This is not a bug.  See the release notes:
>
>        Adjust PL/pgSQL's error line numbering code to be consistent
>        with other PLs (Pavel Stehule)
>
>        Previously, PL/pgSQL would ignore (not count) an empty line at
>        the start of the function body. Since this was inconsistent with
>        all other languages, the special case was removed.
>
>                        regards, tom lane
>



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2011-06-10 02:23 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-06-10 01:58 Difference in postgres9.0.4 and postgres9.1beta1 when displaying error lines in functions with comments Abel Abraham Camarillo Ojeda <acamari@verlet.org>
2011-06-10 02:17 ` Abel Abraham Camarillo Ojeda <acamari@verlet.org>
2011-06-10 02:22 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-06-10 02:23   ` Abel Abraham Camarillo Ojeda <acamari@verlet.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox