Re: Commit within a PL/PGSQL procedure - Mailing list pgsql-novice

From Tom Lane
Subject Re: Commit within a PL/PGSQL procedure
Date
Msg-id 21082.1055944001@sss.pgh.pa.us
Whole thread Raw
In response to Re: Commit within a PL/PGSQL procedure  (Harry Broomhall <harry.broomhall@uk.easynet.net>)
Responses Re: Commit within a PL/PGSQL procedure  (Harry Broomhall <harry.broomhall@uk.easynet.net>)
List pgsql-novice
Harry Broomhall <harry.broomhall@uk.easynet.net> writes:
> Tom Lane writes:
>> If so, the most likely explanation is just
>> that the list of deferred trigger events is getting too large.  This is
>> a known deficiency on our TODO list (it should be possible to shove the
>> list out to disk when it gets too large).

>   Any way round this?

Not much :-(.  AFAIR there is no way to get the trigger list to be
processed while you're inside your function --- you have to return to
the outer command loop.  (The correctness of this is debatable, but
that's how things work at the moment.)  So you must either break your
work into multiple function calls, or not use foreign keys
while you're building the new table.  You could think about adding
the FK constraint after you're done inserting data.

            regards, tom lane

pgsql-novice by date:

Previous
From: Dani Oderbolz
Date:
Subject: Re: sql question (hopefully)
Next
From: "Mel Jamero"
Date:
Subject: Re: sql question (hopefully)