Re: Weird error message in SQL function call

From: Vincenzo Romano <vincenzo(dot)romano(at)gmail(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Weird error message in SQL function call
Date: 2007-07-16 12:53:38
Message-ID: 200707161453.38639.vincenzo.romano@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday 16 July 2007 12:18:23 Richard Huxton wrote:
> Vincenzo Romano wrote:
> > Hi all.
> >
> > I've got this error message while running an SQL function:
> >
> > ---- BEGIN
> > psql:filtb.sql:1029: ERROR: COMMIT is not allowed in a SQL
> > function CONTEXT: SQL function "f_relazione" during startup
> > funzione SQL "f_relazione" istruzione 1
> > ---- END
> >
> > Of course, I have no COMMIT command either in the function itself
> > or in any other function called by f_relazione().
>
> Seeing as you are reading in a large .sql file, I'd look for a
> quoting error - if the closing quote for the function-body isn't
> correct it'll run on, and then encounter a COMMIT further down the
> file.

You hit the spot!

The actual problem was in a deeper function body that used to be
PgPLSQL and is now SQL.
A spurious "END;" in the end of the body was being interpreted as a
COMMIT;

Thanks.

--
Vincenzo Romano
--
Maybe Computer will never become as intelligent as Humans.
For sure they won't ever become so stupid. [VR-1988]

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rajarshi Guha 2007-07-16 13:02:56 Re: count the number of bits set to 1 in a bit string field
Previous Message Richard Huxton 2007-07-16 10:18:23 Re: Weird error message in SQL function call