Skip site navigation (1) Skip section navigation (2)

Re: Does a connection support multiple transactions.

From: george young <gry(at)ll(dot)mit(dot)edu>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Does a connection support multiple transactions.
Date: 2006-03-30 15:09:12
Message-ID: 20060330100912.277aee4f.gry@ll.mit.edu (view raw or flat)
Thread:
Lists: pgsql-novice
On Mon, 27 Mar 2006 11:28:52 -0800
johnf <jfabiani(at)yolo(dot)com> threw this fish to the penguins:

> Suse 10.0 using the Free Pascal Compiler connection version 2.1.1.
> 
> I have opened a connection to a database (FPC uses the postgres c interface).  
> When I attempt to make two queries using the same connection I get an error 
> that suggest I have to close the first query (it actually sends a 'begin').  
> The question is NOT how Pascal works but if Postgres will accept multiple 
> queries via one connection or do queries have to be serial. Will postgres 
> allow two queries to overlap?  I think postgres will allow nested 
> 'begins' (not sure about that).   I'm not sure I'm asking the question 
> correctly.  But in the windows world I only open one connection (normally via 
> ODBC) and can make several queries (one right after the other and sometimes 
> in the same query i.e 'select * from customers;select * from contacts').  
> Each of the queries are live and I'm able to update if required.  I have to 
> save the data with a commit but I still can have the two queries available.

A transaction starts with a "begin" statement and concludes with
either an "commit" or "rollback".  Postgres does not (yet)
support nested transactions, so you must end the current transaction
before starting a new one.  Within a transaction you may certainly
execute many selects, updates, inserts, deletes, etc.

I don't know what the pascal DB API looks like, so its hard to discern
exactly what your problem is.  Could you post some specific code, and
explain what your intent is, and what doesn't work?  Also, please
always mention your postgres version and platform to help people help
you.

I seem to recall encountering some API that did not allow multiple ";"
separated statements in one call.  But any API must allow consecutive
calls within a transaction.

-- George Young

> I'm sure this question is not very clear but I hope some guru will figure it 
> out.
> 
> 
> Thanks
> 
> John
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
> 


-- 
"Are the gods not just?"  "Oh no, child.
What would become of us if they were?" (CSL)

In response to

pgsql-novice by date

Next:From: George WeaverDate: 2006-03-30 15:23:06
Subject: Puzzling behaviour running C Function
Previous:From: Keith WorthingtonDate: 2006-03-29 20:43:40
Subject: Re: Change database encoding

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group