![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Can I write a stored procedure which does an automonous commit? I saw something on a website that claimed "you can't get there from here" in postgresSql but then suggested calling an pl/perl routine to do that. Can anyone sort me out on that point? I'm coming from Oracle where autonomous commits have been possible for quite a while. Thanks in advance |
#3
| |||
| |||
|
|
Can I write a stored procedure which does an automonous commit? I saw something on a website that claimed "you can't get there from here" in postgresSql but then suggested calling an pl/perl routine to do that. Can anyone sort me out on that point? I'm coming from Oracle where autonomous commits have been possible for quite a while. In Postgres, it is not possible to do an autonomous commit using "PRAGMA" statement. Postgres is not pragmatic, knows no pragmas. One execution thread chan have one current transaction and that's it. Autonomous transactions can be simulated by using more than one thread. Essentially, you wouldn't do "autonomous transaction", you would send the SQL to an asynchronous process which would execute the transaction and return the results. This is most often used to make log entries in case of the transaction failure. How would you do that, depends on your favorite programming tool. |
#4
| |||
| |||
|
|
Mladen Gogala wrote: Can I write a stored procedure which does an automonous commit? SNIP In Postgres, it is not possible to do an autonomous commit using "PRAGMA" statement. SNIP |
|
asynchronous process which would execute the transaction and return the results. SNIP ... or you use the "dblink" contrib to establish a loopback connection inside your stored procedure, which then is its own session and consequently its own transaction. You can find the port, database and user name with SELECT current_setting('port'), current_database(), current_user; SNIP |
#5
| |||
| |||
|
|
1. Submitting a job to background, to be run in the future (at time specified by the call, OR immediately) |
|
2. Sending messages (data, arguments, pointer to data, whatever) to a different session via in internal queuing system. |
#6
| |||
| |||
|
|
Lee, 17.12.2009 16:38: 1. Submitting a job to background, to be run in the future (at time specified by the call, OR immediately) I think pgAgent is very similar to Oracle's dbms_job functionality. http://www.pgadmin.org/docs/1.4/pgagent.html 2. Sending messages (data, arguments, pointer to data, whatever) to a different session via in internal queuing system. I guess LISTEN/NOTIFY is be what you are looking for: http://www.postgresql.org/docs/curre...ql-listen.html http://www.postgresql.org/docs/curre...ql-notify.html Thomas Hmmmmm.....That's an interesting feature, but it doesnt seem to be able |
#7
| |||
| |||
|
|
Lee, 17.12.2009 16:38: 1. Submitting a job to background, to be run in the future (at time specified by the call, OR immediately) I think pgAgent is very similar to Oracle's dbms_job functionality. http://www.pgadmin.org/docs/1.4/pgagent.html Very nice, but not what I'm looking for. Unless I'm misreading the |
#8
| |||
| |||
|
|
Can I write to a file (a plain old operating system file, that is) from postgres (Without a commit?) Can I read an operating system file from a postgres stored procedure? |
#9
| |||
| |||
|
|
1. Submitting a job to background, to be run in the future (at time specified by the call, OR immediately) |
|
2. Sending messages (data, arguments, pointer to data, whatever) to a different session via in internal queuing system. |
#10
| ||||
| ||||
|
|
Thomas Kellerer wrote: Lee, 17.12.2009 16:38: 1. Submitting a job to background, to be run in the future (at time specified by the call, OR immediately) I think pgAgent is very similar to Oracle's dbms_job functionality. http://www.pgadmin.org/docs/1.4/pgagent.html 2. Sending messages (data, arguments, pointer to data, whatever) to a different session via in internal queuing system. I guess LISTEN/NOTIFY is be what you are looking for: http://www.postgresql.org/docs/curre...ql-listen.html http://www.postgresql.org/docs/curre...ql-notify.html Thomas Hmmmmm.....That's an interesting feature, but it doesnt seem to be able to pass information as a parameter, unless I put the data into a table (and commit) then have the signalled session read the table to find its data. It also seems that one must commit in the sender, or the signal wont be delivered. So I cant send info to another session and have that other session put the data into a table without first having issued a commit in the original (sending) session. |
|
So I cant simulate an autonomous commit that way. |
|
Can I write to a file (a plain old operating system file, that is) from postgres (Without a commit?) |
|
Can I read an operating system file from a postgres stored procedure? |
![]() |
| Thread Tools | |
| Display Modes | |
| |