Felipe Nogueira wrote:
I have the following function

CREATE OR REPLACE FUNCTION "public"."data" (integer, integer) RETURNS
integer AS
$body$
DECLARE
   vDATA integer;
BEGIN
COMMIT;
END;
$body$
LANGUAGE 'plpgsql' STABLE CALLED ON NULL INPUT SECURITY INVOKER;

When  I execute i have the error

ERROR:  SPI_execute_plan failed executing query "COMMIT":
SPI_ERROR_TRANSACTION
CONTEXT:  PL/pgSQL function "data" line 4 at SQL statement

You can't commit a transaction inside a function. What were you expecting to happen?

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

               http://www.postgresql.org/about/donate

Reply via email to