Weird error message in SQL function call

Started by Vincenzo Romanoover 18 years ago3 messagesgeneral
Jump to latest
#1Vincenzo Romano
vincenzo.romano@gmail.com

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().
In the syslog I see that this is labelled as error #0A000 "Feature not
supported".

Is there any hint?

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

#2Richard Huxton
dev@archonet.com
In reply to: Vincenzo Romano (#1)
Re: Weird error message in SQL function call

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.

--
Richard Huxton
Archonet Ltd

#3Vincenzo Romano
vincenzo.romano@gmail.com
In reply to: Richard Huxton (#2)
Re: Weird error message in SQL function call

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]