Re: [GENERAL] Transactions and functions

2016-09-25 Thread amul sul
On Fri, Sep 23, 2016 at 9:14 PM, Арсен Арутюнян wrote: > would you like to help me with several questions: > 1)are all functions atomic? Yes, of course. > 2)are they execute in a single query? Same as executing n-number of SQL statements between BEGIN-COMMIT block. Regards, Amul -- Sent v

Re: [GENERAL] Transactions and functions

2016-09-23 Thread Adrian Klaver
On 09/23/2016 08:44 AM, Арсен Арутюнян wrote: Hello all i have the table create table testpr(id serial,priority integer,unique(priority) DEFERRABLE, primary key(id)); and procedure: CREATE OR REPLACE FUNCTION JobPriorityChange(JobId bigint,NewPrior integer) RETURNS void AS $$ DECLARE PrevPrio

[GENERAL] Transactions and functions

2016-09-23 Thread Арсен Арутюнян
Hello all i have the table create table testpr(id serial,priority integer,unique(priority) DEFERRABLE, primary key(id)); and procedure: CREATE OR REPLACE FUNCTION JobPriorityChange(JobId bigint,NewPrior integer) RETURNS void AS $$ DECLARE PrevPrior integer; BEGIN PrevPrior := (select priority

Re: [GENERAL] Transactions, stats and analyze (oh-my)

2016-02-16 Thread Tom Lane
Steve Crawford writes: > I would like to roll a number of steps into a transaction. What happens to > the stats data generated by ANALYZE if the transaction is rolled back? > This message says the stats are reverted: > http://postgresql.nabble.com/Analyze-during-a-transaction-td5775069.html That

[GENERAL] Transactions, stats and analyze (oh-my)

2016-02-16 Thread Steve Crawford
We have certain processes that import data then process and distribute the data. Since the processing looks primarily, but not exclusively, at the new records an ANALYZE prior to processing yields better plans. Although the table changes will trigger autovacuum to analyze the table this happens too

Re: [GENERAL] Transactions to create pg_multixact members and offsets

2014-11-25 Thread Dev Kumkar
On Fri, Nov 21, 2014 at 1:14 AM, Alvaro Herrera wrote: > > If there are foreign keys on the tables, the system internally runs some > SELECT FOR KEY SHARE queries on the referenced tables (the ones > containing the primary or unique keys). You can get some multixacts > that way too. > > -- > Álv

Re: [GENERAL] Transactions to create pg_multixact members and offsets

2014-11-20 Thread Alvaro Herrera
Dev Kumkar wrote: > On Thu, Nov 20, 2014 at 11:15 PM, Alvaro Herrera > wrote: > > Merely waiting does not, but more than one lock being acquired on a > > tuple does cause a multixact to be created. Try SELECT FOR SHARE on two > > transactions on the same tuple. > > Sure. > Also what if there are

Re: [GENERAL] Transactions to create pg_multixact members and offsets

2014-11-20 Thread Dev Kumkar
On Thu, Nov 20, 2014 at 11:15 PM, Alvaro Herrera wrote: > Search for "burnmulti" in the archives, which is a contrib module to > test pg_multixact. > Thanks, got some links. Will give a try and get back. Merely waiting does not, but more than one lock being acquired on a > tuple does cause a mu

Re: [GENERAL] Transactions to create pg_multixact members and offsets

2014-11-20 Thread Alvaro Herrera
Dev Kumkar wrote: > Hellos, > > How to manually increase pg_multixact members and offsets? Search for "burnmulti" in the archives, which is a contrib module to test pg_multixact. > Does a transaction waiting for exclusive lock or shared lock result into > entry being created in pg_multixact? Me

[GENERAL] Transactions to create pg_multixact members and offsets

2014-11-20 Thread Dev Kumkar
Hellos, How to manually increase pg_multixact members and offsets? Does a transaction waiting for exclusive lock or shared lock result into entry being created in pg_multixact? Excerpt of multixact.c: /*- 2 * 3 * multixact

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Alban Hertroys
On 28 Feb 2011, at 22:07, Andre Lopes wrote: > Hi, > > Thanks for the reply. > > How can I user the RETURNING without pl/sql? My PostgreSQL version is 8.3 > > Can you give me some example? http://www.postgresql.org/docs/8.3/interactive/sql-insert.html Most notably the last example on that pag

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Andre Lopes
Hi, Thanks for the reply. How can I user the RETURNING without pl/sql? My PostgreSQL version is 8.3 Can you give me some example? Best Regards, On Mon, Feb 28, 2011 at 7:00 PM, Alban Hertroys wrote: > On 28 Feb 2011, at 24:37, David Johnston wrote: > >> Using pl/pgsql you can: > > You don'

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Alban Hertroys
On 28 Feb 2011, at 24:37, David Johnston wrote: > Using pl/pgsql you can: You don't need pl/pgsql for that. You can return the resultset of the first insert into a client-side variable (while still making use of the RETURNING-clause of course). Of course, the benefit of using pl/pgsql for this

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-28 Thread Andre Lopes
that you need. > > David J. > > -Original Message- > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andre Lopes > Sent: Sunday, February 27, 2011 3:34 PM > To: postgresql Forums > Subject: [GENERAL] Transactions

Re: [GENERAL] Transactions and ID's generated by triggers

2011-02-27 Thread David Johnston
2011 3:34 PM To: postgresql Forums Subject: [GENERAL] Transactions and ID's generated by triggers Hi, I have a situation that I dont know how to deal. I have 2 tables "tdir_uris_files" and "tdir_uri_files_details". Please see the Image in attach. The table "tdi

[GENERAL] Transactions and ID's generated by triggers

2011-02-27 Thread Andre Lopes
Hi, I have a situation that I dont know how to deal. I have 2 tables "tdir_uris_files" and "tdir_uri_files_details". Please see the Image in attach. The table "tdir_uris_files" have the field "id_ordinal" that is originated by a trigger(before insert) The table "tdir_uri_files_details" use the f

Re: [GENERAL] transactions within stored procedures

2010-07-21 Thread Peter Geoghegan
On 21 July 2010 10:43, Robot Tom wrote: > Hi, > > Has there been any progress on nested transactions in the last 10 years? > PostgreSQL has had subtransactions since version 8.0, if that's what you mean. If you're experiencing OOM a lot, a high work_mem setting is often the culprit. This can be s

Re: [GENERAL] transactions within stored procedures

2010-07-21 Thread Robot Tom
Hi, Has there been any progress on nested transactions in the last 10 years? I am in a situation where I have a script that executes a number of functions that build and populate a database including a rather large lookup table (80GB) along with a number of large indexes (10GB). I am trying

Re: [GENERAL] Transactions, How to?

2010-02-20 Thread Andre Lopes
Tkanks for the reply. Best Regards, On Sat, Feb 20, 2010 at 5:34 PM, Andreas Kretschmer < akretsch...@spamfence.net> wrote: > Andre Lopes wrote: > > > > > But I can't complite if I add to the procedure a BEGIN and a COMMIT. I > think > > this BEGIN and COMMIT will make a real transaction or I

Re: [GENERAL] Transactions, How to?

2010-02-20 Thread Andreas Kretschmer
Andre Lopes wrote: > > But I can't complite if I add to the procedure a BEGIN and a COMMIT. I think > this BEGIN and COMMIT will make a real transaction or I'am wrong? Right, you are wrong ;-) A function is atomic, you don't need a begin/commit inside. Andreas -- Really, I'm not out to des

[GENERAL] Transactions, How to?

2010-02-20 Thread Andre Lopes
Hi, I need to do a procedure that does an INSERT and an UPDATE. The procedure works in this way: [quote] CREATE OR REPLACE FUNCTION "public"."apr_insert_newsletter_distritos" ("pSTRING_ARRAY" varchar, "pEMAIL" varchar, "pITEMS" integer, "pID_WEBSITE_RECOLHA" varchar) RETURNS void AS $body$ DECLA

Re: [GENERAL] Transactions in user defined function

2009-03-13 Thread Tino Wildenhain
Grzegorz Jaśkiewicz wrote: On Fri, Mar 13, 2009 at 12:03 PM, Jasid ZA wrote: Hi, Can we use sql transaction(BEGIN, COMMIT, REVOKE) inside a user defined function in Postgresql 8.3? looking forward to hear from you Nope. If function does something naughty - do RAISE EXCEPTION, that will brea

Re: [GENERAL] Transactions in user defined function

2009-03-13 Thread Tino Wildenhain
Jasid ZA wrote: Hi, Can we use sql transaction(BEGIN, COMMIT, REVOKE) inside a user defined function in Postgresql 8.3? Would that part of the documentation help? http://www.postgresql.org/docs/8.3/interactive/plpgsql-structure.html "Functions and trigger procedures are always executed with

Re: [GENERAL] Transactions in user defined function

2009-03-13 Thread Grzegorz Jaśkiewicz
On Fri, Mar 13, 2009 at 12:03 PM, Jasid ZA wrote: > Hi, > > Can we use sql transaction(BEGIN, COMMIT, REVOKE) inside a user defined > function in Postgresql 8.3? > > looking forward to hear from you Nope. If function does something naughty - do RAISE EXCEPTION, that will break transaction and que

[GENERAL] Transactions in user defined function

2009-03-13 Thread Jasid ZA
Hi, Can we use sql transaction(BEGIN, COMMIT, REVOKE) inside a user defined function in Postgresql 8.3? looking forward to hear from you Thanks -Jasid- -- With warm regards Jasid Z. A +91 9946109809

Re: [HACKERS] [GENERAL] Transactions within a function body

2008-10-02 Thread Asko Oja
On Thu, Oct 2, 2008 at 6:46 PM, Bob Henkel <[EMAIL PROTECTED]> wrote: > Have you looked at creating a function in perl and creating a new > connection? Or using a dblink query which can create a new connection? > These two methods work. I have used them to insert to a log table regardless > of the

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Gurjeet Singh
No, in Oracle too SAVEPOINT and AUTONOMOUS transaction are different beasts. On Thu, Oct 2, 2008 at 9:27 PM, Bob Henkel <[EMAIL PROTECTED]> wrote: > Coming from an Oracle background my understanding is they're one in the > same. > > > > > On Thu, Oct 2, 2008 at 10:37 AM, Alvaro Herrera < > [EMAIL

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Bob Henkel
Coming from an Oracle background my understanding is they're one in the same. On Thu, Oct 2, 2008 at 10:37 AM, Alvaro Herrera <[EMAIL PROTECTED]>wrote: > Bob Henkel escribió: > > Have you looked at creating a function in perl and creating a new > > connection? Or using a dblink query which can

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Bob Henkel
Have you looked at creating a function in perl and creating a new connection? Or using a dblink query which can create a new connection? These two methods work. I have used them to insert to a log table regardless of the parent transaction being commited or rolled back. A old example I posted of u

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Alvaro Herrera
Gurjeet Singh escribió: > I have seen this feature being asked for, and this work-around suggested so > many times. If plpgql does it internally, why not provide a clean interface > for this? Is there some road-block, or that nobody has ever tried it? Initially we aimed at just exposing SAVEPOINT

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Alvaro Herrera
Bob Henkel escribió: > Have you looked at creating a function in perl and creating a new > connection? Or using a dblink query which can create a new connection? > These two methods work. I have used them to insert to a log table regardless > of the parent transaction being commited or rolled back.

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Gurjeet Singh
On Thu, Oct 2, 2008 at 8:40 PM, Alvaro Herrera <[EMAIL PROTECTED]>wrote: > Reg Me Please escribió: > > Il Thursday 02 October 2008 16:15:10 Alvaro Herrera ha scritto: > > > > You can nest blocks arbitrarily, giving you the chance to selectively > > > rollback pieces of the function. It's only a b

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Bob Henkel
Have you looked at creating a function in perl and creating a new connection? Or using a dblink query which can create a new connection? These two methods work. I have used them to insert to a log table regardless of the parent transaction being commited or rolled back. A old example I posted of u

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Reg Me Please escribió: >> You mean I can issue a ROLLBACK command within a BEGIN...END; block to roll >> it >> back? > No -- I mean you can use BEGIN/EXCEPTION/END blocks as you like, nesting > them or putting one after another. Complementing this w

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Reg Me Please
Il Thursday 02 October 2008 17:10:23 Alvaro Herrera ha scritto: > Reg Me Please escribió: > > Il Thursday 02 October 2008 16:15:10 Alvaro Herrera ha scritto: > > > You can nest blocks arbitrarily, giving you the chance to selectively > > > rollback pieces of the function. It's only a bit more awkw

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Alvaro Herrera
Reg Me Please escribió: > Il Thursday 02 October 2008 16:15:10 Alvaro Herrera ha scritto: > > You can nest blocks arbitrarily, giving you the chance to selectively > > rollback pieces of the function. It's only a bit more awkward. > > You mean I can issue a ROLLBACK command within a BEGIN...END;

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Reg Me Please
Il Thursday 02 October 2008 16:15:10 Alvaro Herrera ha scritto: > Reg Me Please escribió: > > Well, if it is a limitation, and having it would lead to a "better > > product", why not making it a feature for the next still-open release? > > Because no one is working on implementing it? > > > In my o

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Alvaro Herrera
Reg Me Please escribió: > Well, if it is a limitation, and having it would lead to a "better product", > why not making it a feature for the next still-open release? Because no one is working on implementing it? > In my opinion that's more than a limitation, it's a missing feature. > In your code

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Albe Laurenz
Richard Huxton wrote: >> After a discussion on comp.databases.postgresql I realized that this >> is actually a limitation. >> >> Consider the following: >> >> BEGIN >>UPDATE ... >>UPDATE ... >>UPDATE ... >> EXCEPTION >>WHEN integrity_constraint_violation THEN >> ... >> END;

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Reg Me Please
Hi. My humble opinion follows. One point here is that the decision for the ROLLBACK could possibly be different from errors. It could simply be based upon a generic expression, not just the conditions seen in "Appendix A" of the manual. An exception is something different from a transaction, de

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Reg Me Please
Well, if it is a limitation, and having it would lead to a "better product", why not making it a feature for the next still-open release? In my opinion that's more than a limitation, it's a missing feature. In your code you often need to create savepoints to delay the decision for the commitment.

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Richard Huxton
Albe Laurenz wrote: > After a discussion on comp.databases.postgresql I realized that this > is actually a limitation. > > Consider the following: > > BEGIN >UPDATE ... >UPDATE ... >UPDATE ... > EXCEPTION >WHEN integrity_constraint_violation THEN > ... > END; > > If the fir

Re: [GENERAL] Transactions within a function body

2008-10-02 Thread Albe Laurenz
Alvaro Herrera wrote: > > > Is there a way to have (sub)transactions within a function body? > > > I'd like to execute some code (a transaction!) inside a function and later > > > decide whether that transaction is to be committed or not. > > > > You could issue a "SAVEPOINT name". If at the end y

Re: [GENERAL] Transactions within a function body

2008-10-01 Thread Alvaro Herrera
Dennis Brakhane escribió: > On Wed, Oct 1, 2008 at 5:54 PM, Reg Me Please <[EMAIL PROTECTED]> wrote: > > Hi all. > > > > Is there a way to have (sub)transactions within a function body? > > I'd like to execute some code (a transaction!) inside a function and later > > decide whether that transactio

Re: [GENERAL] Transactions within a function body

2008-10-01 Thread Dennis Brakhane
On Wed, Oct 1, 2008 at 5:54 PM, Reg Me Please <[EMAIL PROTECTED]> wrote: > Hi all. > > Is there a way to have (sub)transactions within a function body? > I'd like to execute some code (a transaction!) inside a function and later > decide whether that transaction is to be committed or not. You coul

[GENERAL] Transactions within a function body

2008-10-01 Thread Reg Me Please
Hi all. Is there a way to have (sub)transactions within a function body? I'd like to execute some code (a transaction!) inside a function and later decide whether that transaction is to be committed or not. Thanks. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make c

Re: [GENERAL] Transactions within a function body

2008-10-01 Thread Andreas Kretschmer
Reg Me Please <[EMAIL PROTECTED]> schrieb: > Hi all. > > Is there a way to have (sub)transactions within a function body? No. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was

Re: [GENERAL] Transactions through JDBC

2007-04-11 Thread Jan de Visser
On Wednesday 11 April 2007 14:01:55 Alberto Molteni wrote: > >You should use > > > >  conn.setAutoCommit(false); > >  conn.execute(...) > >  conn.execute(...) > >  conn.execute(...) > >  conn.commit(); > > > > > > Thanks! > > jan > > Then,  conn.setAutoCommit(false); has to be regarded as a begin s

Re: [GENERAL] Transactions through JDBC

2007-04-11 Thread Jan de Visser
On Wednesday 11 April 2007 12:49:49 Albert wrote: > Hi all! > > Actually I have a client-server application with one server and many > clients each one of which opens a different connection to the postgres > database. In order to avoid those known problems with the execution of > the different clie

Re: [GENERAL] Transactions through JDBC

2007-04-11 Thread Alberto Molteni
You should use conn.setAutoCommit(false); conn.execute(...) conn.execute(...) conn.execute(...) conn.commit(); Thanks! jan Then, conn.setAutoCommit(false); has to be regarded as a begin statement? I had already put the autocommit flag to false soon after the creation of the connec

[GENERAL] Transactions through JDBC

2007-04-11 Thread Albert
Hi all! Actually I have a client-server application with one server and many clients each one of which opens a different connection to the postgres database. In order to avoid those known problems with the execution of the different clients' operations at database, I implemented everything in this

Re: [GENERAL] Transactions, PostgreSQL and MS Access front end.

2006-04-25 Thread arthurjr07
Try to use ADO Dim con as ADODB.Connection set con = new ADODB.Connection con.Open "DRIVER={PostgreSQL}; SERVER=ipaddress; port=5432; DATABASE=dbname; UID=username;PWD=password;" con.BeginTrans con.Execute "UPDATE accounts SET balance = balance + 10

Re: [GENERAL] Transactions, PostgreSQL and MS Access front end.

2006-04-24 Thread Karen Hill
Cool. I knew ADO could do transactions on Access's JET database engine, but didn't know they could do so on another RDBMS like PostgreSQL. So basically I can use the BeginTrans and CommitTrans to do the work of PostgreSQL's BEGIN; and COMMIT; On a adjacent topic, how does PostgreSQL know that Be

Re: [GENERAL] Transactions, PostgreSQL and MS Access front end.

2006-04-24 Thread vladimir
Karen Hill wrote: >>From Access I'd like to run pass the following from MS Access to > PostgreSQL 8.1 using VBA: > > BEGIN; > UPDATE accounts SET balance = balance + 100.00 WHERE acctnum = 12345; > UPDATE accounts SET balance = balance - 100.00 WHERE acctnum = 7534; > COMMIT; > > It won't let me

Re: [GENERAL] Transactions, PostgreSQL and MS Access front end.

2006-04-23 Thread Karen Hill
Bruce Momjian wrote: > Karen Hill wrote: > > >From Access I'd like to run pass the following from MS Access to > > PostgreSQL 8.1 using VBA: > > > > BEGIN; > > UPDATE accounts SET balance = balance + 100.00 WHERE acctnum = 12345; > > UPDATE accounts SET balance = balance - 100.00 WHERE acctnum = 7

Re: [GENERAL] Transactions, PostgreSQL and MS Access front end.

2006-04-23 Thread Bruce Momjian
Karen Hill wrote: > >From Access I'd like to run pass the following from MS Access to > PostgreSQL 8.1 using VBA: > > BEGIN; > UPDATE accounts SET balance = balance + 100.00 WHERE acctnum = 12345; > UPDATE accounts SET balance = balance - 100.00 WHERE acctnum = 7534; > COMMIT; > > It won't let me

[GENERAL] Transactions, PostgreSQL and MS Access front end.

2006-04-23 Thread Karen Hill
>From Access I'd like to run pass the following from MS Access to PostgreSQL 8.1 using VBA: BEGIN; UPDATE accounts SET balance = balance + 100.00 WHERE acctnum = 12345; UPDATE accounts SET balance = balance - 100.00 WHERE acctnum = 7534; COMMIT; It won't let me. Any ideas solutions? --

Re: [GENERAL] Transactions

2006-03-18 Thread Kevin Brown
On Saturday 18 March 2006 12:58, Florian G. Pflug wrote: > Kevin Brown wrote: > > So what you're saying is that my commits and rollbacks should be async, > > correct? > > No, you should always use _async(), and never, ever use query() or exec() > in a multi-threaded app. > > > I don't quite underst

Re: [GENERAL] Transactions

2006-03-18 Thread Florian G. Pflug
Kevin Brown wrote: On Saturday 18 March 2006 12:31, Florian G. Pflug wrote: I've been creating a databased application with PostgreSQL for a while now and have loved it, though we just recently stumbled on an interesting bug. I have a particular dialog which can do all kinds of incredibly compl

Re: [GENERAL] Transactions

2006-03-18 Thread Kevin Brown
On Saturday 18 March 2006 12:31, Florian G. Pflug wrote: > Kevin Brown wrote: > > I've been creating a databased application with PostgreSQL for a while > > now and have loved it, though we just recently stumbled on an interesting > > bug. > > > > I have a particular dialog which can do all kinds o

Re: [GENERAL] Transactions

2006-03-18 Thread Florian G. Pflug
Kevin Brown wrote: I've been creating a databased application with PostgreSQL for a while now and have loved it, though we just recently stumbled on an interesting bug. I have a particular dialog which can do all kinds of incredibly complicated things to the database. Of course I didn't want

Re: [GENERAL] Transactions

2006-03-17 Thread Tom Lane
Kevin Brown <[EMAIL PROTECTED]> writes: > When the "deadlock" occurs: > [EMAIL PROTECTED]:~> ps -elF | grep postgres > 1 S postgres 6020 17767 0 75 0 - 10585 - 15136 0 19:57 ? > 00:00:29 postgres: dli dli 127.0.0.1(39869) idle in transaction > 1 S postgres 6195 17767 0 76 0 - 10323 semtim

Re: [GENERAL] Transactions

2006-03-17 Thread Kevin Brown
On Saturday 18 March 2006 00:19, Tom Lane wrote: > Kevin Brown <[EMAIL PROTECTED]> writes: > > So when the dialog opens, it executes a BEGIN, and then based on whether > > they clicked ok or cancel on the dialog, it'd COMMIT or ROLLBACK. This > > worked fine for me in testing, but now that I have

Re: [GENERAL] Transactions

2006-03-17 Thread Tom Lane
Kevin Brown <[EMAIL PROTECTED]> writes: > So when the dialog opens, it executes a BEGIN, and then based on whether they > clicked ok or cancel on the dialog, it'd COMMIT or ROLLBACK. This worked > fine for me in testing, but now that I have two people using this app > simulatneously, if they bot

[GENERAL] Transactions

2006-03-17 Thread Kevin Brown
I've been creating a databased application with PostgreSQL for a while now and have loved it, though we just recently stumbled on an interesting bug. I have a particular dialog which can do all kinds of incredibly complicated things to the database. Of course I didn't want to have to write the

Re: [GENERAL] Transactions, Triggers and Error Messages

2005-11-08 Thread Richard Huxton
Ledina Hido wrote: Thinking about it, the EXCEPTION statement would be inside my user- defined function (where I raise the exception in the first place), so I cannot see how that would help. As far as I could understand, I cannot call "ROLLBACK" (which is what I want to do) inside a user d

[GENERAL] Transactions, Triggers and Error Messages

2005-11-08 Thread lh1101
Hi, I am trying to use triggers inside transactions to perform some multiplicity checking on the data inserted onto the tables but I am having some problems retrieving the error message. I have two tables declared as follows: > create table pers ( pid int not null primary

Re: [GENERAL] Transactions, Triggers and Error Messages

2005-11-08 Thread Ledina Hido
On Tue, Nov 08, 2005 at 11:03:50PM +, Ledina Hido wrote:> Quoting Tom Lane <[EMAIL PROTECTED]>:> > > What are you running this in?  ISTM this is a problem with bad  > structure> > of client-side code, not something to be fixed on the server side.> >> >                         regards, tom lane>

Re: [GENERAL] Transactions, Triggers and Error Messages

2005-11-08 Thread Ledina Hido
That's great. Thank you very much for you help.LedinaOn Tue, Nov 08, 2005 at 11:03:50PM +, Ledina Hido wrote:> Quoting Tom Lane <[EMAIL PROTECTED]>:> > > What are you running this in?  ISTM this is a problem with bad  > structure> > of client-side code, not something to be fixed on the server s

Re: [GENERAL] Transactions, Triggers and Error Messages

2005-11-08 Thread Jim C. Nasby
On Tue, Nov 08, 2005 at 11:03:50PM +, Ledina Hido wrote: > Quoting Tom Lane <[EMAIL PROTECTED]>: > > > What are you running this in? ISTM this is a problem with bad > structure > > of client-side code, not something to be fixed on the server side. > > > > regards, tom la

Re: [GENERAL] Transactions, Triggers and Error Messages

2005-11-08 Thread Ledina Hido
Quoting Tom Lane <[EMAIL PROTECTED]>: > What are you running this in? ISTM this is a problem with bad structure > of client-side code, not something to be fixed on the server side. > >regards, tom lane I'm using pgAdmin3. Basically when I run the query the first time it

Re: [GENERAL] Transactions, Triggers and Error Messages

2005-11-08 Thread Tom Lane
Ledina Hido <[EMAIL PROTECTED]> writes: > Now when I run the following (after inserting person with id=5 into > pers table): > begin; > set constraints all deferred; > insert into tasks (pid, task) values (5, 'firstTask'); > insert into tasks (pid, task) values (5, 'secondTask'); > insert into t

[GENERAL] Transactions, Triggers and Error Messages

2005-11-08 Thread Ledina Hido
Hi all, Sorry for the trouble but I am trying to use triggers inside transactions to perform some multiplicity checking on the data inserted onto the tables but I am having some problems retrieving the error message. I have two tables declared as follows:> create table pers (   

Re: [GENERAL] transactions

2005-06-06 Thread Michael Fuhr
On Mon, Jun 06, 2005 at 09:21:15AM -0400, Douglas McNaught wrote: > "Surabhi Ahuja " <[EMAIL PROTECTED]> writes: > > > say i have two transactions going on simultaneoulsy. > > in one transaction i do an insertion > > and the other transaction i do a delete. > > what will happen if in both the tran

Re: [GENERAL] transactions

2005-06-06 Thread Douglas McNaught
"Surabhi Ahuja " <[EMAIL PROTECTED]> writes: > Hello everyone. > I have the following question: > > say i have two transactions going on simultaneoulsy. > in one transaction i do an insertion > and the other transaction i do a delete. > what will happen if in both the transactions, the insert(in o

[GENERAL] transactions

2005-06-06 Thread Surabhi Ahuja
Title: transactions Hello everyone. I have the following question: say i have two transactions going on simultaneoulsy. in one transaction i do an insertion and the other transaction i do a delete. what will happen if in both the transactions, the insert(in one) and delete(in the other) are

Re: [GENERAL] transactions in multiple action rules

2004-12-20 Thread Tom Lane
Ron Peterson <[EMAIL PROTECTED]> writes: > Do the multiple actions within a multiple action rule implicitly reside > within a transaction? Yes. In the current code it is actually not possible for a single SQL command issued by the client to give rise to more than one transaction. (This might chan

Re: [GENERAL] transactions in multiple action rules

2004-12-20 Thread Bruno Wolff III
On Mon, Dec 20, 2004 at 23:15:39 -0500, Ron Peterson <[EMAIL PROTECTED]> wrote: > Do the multiple actions within a multiple action rule implicitly reside > within a transaction? I notice that if I brace my multiple actions with > BEGIN; and COMMIT;, that I get a syntax error, so I'm assuming tha

[GENERAL] transactions in multiple action rules

2004-12-20 Thread Ron Peterson
Do the multiple actions within a multiple action rule implicitly reside within a transaction? I notice that if I brace my multiple actions with BEGIN; and COMMIT;, that I get a syntax error, so I'm assuming that's because they are superfluous in that context... ? (I want to be sure that I can cou

Re: [GENERAL] transactions, functions, foreign keys

2004-12-15 Thread Larry White
My mistake. There was something else going on and I misinterpreted the cause of the problem. The foreign key references are valid within the transaction even though the initial updates are not yet committed. apologies for the distraction and thanks again for your help. On Wed, 15 Dec 2004 10:3

Re: [GENERAL] transactions, functions, foreign keys

2004-12-15 Thread Michael Fuhr
On Wed, Dec 15, 2004 at 11:53:55AM -0500, Larry White wrote: > I have a function that calls other functions. These other functions > are inserting rows and return the primary key for the inserted row. > Some of the tables are related in a way that they have a foreign key > reference to a table

Re: [GENERAL] transactions, functions, foreign keys

2004-12-15 Thread Terry Lee Tucker
I have never tested a particular scenario like this out, but would AFTER INSERT triggers resolve this issue for you? On Wednesday 15 December 2004 11:53 am, Larry White saith: > Hi, > > I've run into a situation (I should have forseen) and was hoping > someone could show me a way out. > > I have

[GENERAL] transactions, functions, foreign keys

2004-12-15 Thread Larry White
Hi, I've run into a situation (I should have forseen) and was hoping someone could show me a way out. I have a function that calls other functions. These other functions are inserting rows and return the primary key for the inserted row. Some of the tables are related in a way that they have

Re: [GENERAL] Transactions in different DB

2004-11-17 Thread Tino Wildenhain
Hi, Am Dienstag, den 16.11.2004, 11:22 +0100 schrieb Stefano Farina: > Hi all > I have to develop an embedded database using memory FLASH and memory > RAM > Some tables must be saved in RAM and some tables in FLASH ( RAM and > FLASH are two different mounted directories in the file system). > I sa

Re: [GENERAL] Transactions in different DB

2004-11-17 Thread Ian Barwick
On Tue, 16 Nov 2004 11:22:27 +0100, Stefano Farina <[EMAIL PROTECTED]> wrote: > > Hi all > I have to develop an embedded database using memory FLASH and memory RAM > Some tables must be saved in RAM and some tables in FLASH ( RAM and FLASH > are two different mounted directories in the file sys

[GENERAL] Transactions in different DB

2004-11-16 Thread Stefano Farina
Hi all I have to develop an embedded database using memory FLASH and memory RAM Some tables must be saved in RAM and some tables in FLASH ( RAM and FLASH are two different mounted directories in the file system). I saw it's possible to save different databases in different directories with C

[GENERAL] Transactions and insertion ordering

2004-06-10 Thread James Pharaoh
Hi, I'm trying to work out how to make sure things are read from a table in a consistent order. The table represents a queue of items and also the history of those items. Even with "serializable" transaction isolation I can begin two transactions, insert a record in each, commit the second transa

Re: [GENERAL] transactions in plpgsql

2004-03-19 Thread Richard Huxton
On Friday 19 March 2004 13:01, Martin Marques wrote: > I'm building some functions in plpgsql, and I got to a point where I > thought: How are transactions used in the function? Is it posible to > rollback the modifications that were made to the tables at some point in > the plpgsql function? You

[GENERAL] transactions in plpgsql

2004-03-19 Thread Martin Marques
I'm building some functions in plpgsql, and I got to a point where I thought: How are transactions used in the function? Is it posible to rollback the modifications that were made to the tables at some point in the plpgsql function? -- 09:58:01 up 10 days, 14:29, 4 users, load average: 0.11

[GENERAL] transactions in c api (libpq)?

2004-01-18 Thread Dave
Is it possible to write C code (presumably using libpq) to carry out transactions? I can't seem to find functions in this API which start and end a transaction. If this is not possible, what other programming interfaces will allow me to write transaction code? Thanks ---(

[GENERAL] Transactions across multiples databases

2003-07-31 Thread Sergio Pili
Hello: I need to modify diferent tables in multiples databases in one transaction. Can i do it whitout lost integrity in all databases if "rollback" is executed? Thanks, Sergio Pili ---(end of broadcast)--- TIP 1: subscribe and unsubscribe command

[GENERAL] Transactions <-> Connections and Userrights

2001-09-14 Thread Ravi Ahluwalia
hi over there, how am i able to let a transaction exist among several connections, or is just one possible ? cause my phpskript cuts connection from db bevor reloading itself ofcourse :-) -how can i get information about the group which a user belongs to and its rights ? Thanx a lot Ravi -

Re: [GENERAL] Transactions in rules..

2001-07-09 Thread Jan Wieck
Fabrizio Mazzoni wrote: > Can i use transactions in rules?? > I was trying something like: > > create rule x_test as > on insert to view1 > do instead > ( >begin; >insert into test1 values (new.a,new.b); >insert into test2 values (new.c,new.d); >commit; > ); > > But when i give thi

[GENERAL] transactions on Postgresql

2001-05-28 Thread hicham bouzdad
Hi everybody, my subject is about : DBI / PostgreSql & Transactions with Perl. my code is : $dbh->{AutoCommit} = 0; # begin of transaction while () { ... $sql = "insert into $table ($col) values ($val)"; $res = $dbh->do($sql); } $dbh->rollback;#

[GENERAL] Transactions and *ABORT STATE*

2001-05-25 Thread zilch
I were testing out (using psql) transactions and locking in postgresql using only BEGIN/UPDATE(on a specific table)/COMMIT&ROLLBACK and notices several time that instead of waiting it went into *ABORT STATE*. Why is this? Also I notice that COMMIT'ing a deadlock'ed transaction did nothing but a

Re: [GENERAL] Transactions inside plpgsql?

2001-01-28 Thread Alex Pilosov
Basically, answer is: you can't do it, no matter how you slice it, for a simple reason: postgres doesn't support nested transactions [yet?]. On Sun, 28 Jan 2001, Alan Turner wrote: > Hi > > I've been searching the web/mailing lists/web boards for the answer to a > question I have regarding pos

Re: [GENERAL] Transactions + sequences

2000-09-22 Thread Stephan Szabo
On Fri, 22 Sep 2000, Neil Conway wrote: > Consider the following (PgSQL 7.0.2): > > CREATE SEQUENCE foo; > SELECT nextval('foo'); > -- returns 1 > BEGIN WORK; > SELECT nextval('foo'); > -- returns 2 > ABORT WORK; > SELECT nextval('foo'); > -- returns 3 > > As you can see, even though the trans

[GENERAL] Transactions + sequences

2000-09-22 Thread Neil Conway
Consider the following (PgSQL 7.0.2): CREATE SEQUENCE foo; SELECT nextval('foo'); -- returns 1 BEGIN WORK; SELECT nextval('foo'); -- returns 2 ABORT WORK; SELECT nextval('foo'); -- returns 3 As you can see, even though the transaction has been aborted, the sequence is still incremented. Is there

Re: [GENERAL] Transactions and web applications

2000-06-28 Thread Michael Mayo
- Original Message - From: "Lincoln Yeoh" <[EMAIL PROTECTED]> > What are the recommended ways to do transactions in web applications? > > Right now I have persistent database connections, but currently they are > shared by multiple sessions. So I make sure that database level > transaction

Re: [GENERAL] Transactions and web applications

2000-06-27 Thread brianb-pggeneral
Lincoln Yeoh writes: > At 10:01 PM 26-06-2000 -0400, Michael Mayo wrote: > >- Original Message - > >From: "Lincoln Yeoh" <[EMAIL PROTECTED]> > >> What are the recommended ways to do transactions in web applications? > Let me illustrate the problem with an example: > > page 1 > user logs

  1   2   >