Thread: Question about commit

Question about commit

From
Lee
Date:
Lets say I have the following:

1. A table called LOGDATA

2.  A stored procedure logem( owner, calling_point, message) that
inserts its arguments (assumed varchar2() )
and maybe some extra data such as the date and time, into corresponding
columns in the table LOGDATA and then commits.

3. Now for the hard part.

    I want to call logem()   [something like ... logem( 'test01',
'main_loop', 'passing checkpoint charlie' );  ]
   without having the commit which is coded in logem() causing a commit
action in the routine that invokes logem(), NOR
   do I want a rollback in the calling routine  to wipe out (roll back)
any historical trace information that I've already written to LOGDATA

   If postgreSQL had such a thing as an "automomous transaction" as in
Oracle or mySql, then there would be problem; but AFAIK
   (but then again, I don't know much)   it doesn't, so how do people
get the same effect?

   Surely I'm not the only one who would like to do this sort of thing

Re: Question about commit

From
Tom Lane
Date:
Lee <Lee@JamToday.com> writes:
>    If postgreSQL had such a thing as an "automomous transaction" as in
> Oracle or mySql, then there would be problem; but AFAIK
>    (but then again, I don't know much)   it doesn't, so how do people
> get the same effect?

If you really need it, you can do it with contrib/dblink: connect back
to your own database and issue commands you want to commit immediately.

            regards, tom lane