pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Abel Abraham Camarillo Ojeda <acamari@verlet.org>
To: pgsql-hackers@postgresql.org
Subject: Difference in postgres9.0.4 and postgres9.1beta1 when displaying error lines in functions with comments
Date: Thu, 9 Jun 2011 20:58:48 -0500
Message-ID: <BANLkTinsH_+nuy9kbfca5u1-2XTWpbE_zw@mail.gmail.com> (raw)

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.

view thread (4+ messages)  latest in thread

Message-ID: <BANLkTinsH_+nuy9kbfca5u1-2XTWpbE_zw@mail.gmail.com>
Permalink:  ../BANLkTinsH_+nuy9kbfca5u1-2XTWpbE_zw@mail.gmail.com/
Also on:    postgresql.org/message-id/BANLkTinsH_+nuy9kbfca5u1-2XTWpbE_zw@mail.gmail.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: acamari@verlet.org, pgsql-hackers@postgresql.org
  Subject: Re: Difference in postgres9.0.4 and postgres9.1beta1 when displaying error lines in functions with comments
  In-Reply-To: <BANLkTinsH_+nuy9kbfca5u1-2XTWpbE_zw@mail.gmail.com>
  References: <BANLkTinsH_+nuy9kbfca5u1-2XTWpbE_zw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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