[GENERAL] Transaction safety and large objects. Possible?

2006-01-30 Thread Eric Davies
I've got some server functions that were previously written using libpq. They work fine. However because they need to open their own connection to insert into tables and write into large objects, etc, they aren't transaction safe. That is to say, if a user starts a transaction, executes my

Re: [GENERAL] Transaction safety and large objects. Possible?

2006-01-30 Thread Tom Lane
Eric Davies [EMAIL PROTECTED] writes: Now I'm trying to make the functions transaction safe. In theory, all I need to do is convert my libpq calls to equivalent SPI calls. However, there don't appear to be any SPI equivalents for the large object functions like lo_write and lo_read. What

Re: [GENERAL] transaction safety

2001-02-14 Thread DaVinci
On Tue, Feb 13, 2001 at 09:52:21AM -0500, Tom Lane wrote: DaVinci [EMAIL PROTECTED] writes: procedencia int2 references procedencia, línea int2 references línea, empresa int2 references empresa, Depending on the data values you are working with, it

Re: [GENERAL] transaction safety

2001-02-14 Thread Jan Wieck
DaVinci wrote: On Tue, Feb 13, 2001 at 09:52:21AM -0500, Tom Lane wrote: DaVinci [EMAIL PROTECTED] writes: procedenciaint2 references procedencia, lnea int2 references lnea, empresaint2 references empresa, Depending on the data values you are

Re: [GENERAL] transaction safety

2001-02-14 Thread DaVinci
On Wed, Feb 14, 2001 at 06:34:01AM -0500, Jan Wieck wrote: DaVinci wrote: Problem is with referential integrity like you say. But I don't understand well reason. Interlocks should appear only when values of referenced tables are changed, added or removed, shouldn't they?. But that is

Re: [GENERAL] transaction safety

2001-02-14 Thread Jan Wieck
DaVinci wrote: On Wed, Feb 14, 2001 at 06:34:01AM -0500, Jan Wieck wrote: The problem is, that a referential integrity constraint needs to ensure that from the moment the constraint got checked until your INSERT got made persistent (COMMIT), nobody else has a chance

RE: [GENERAL] transaction safety

2001-02-13 Thread Michael Ansley
Title: RE: [GENERAL] transaction safety Hi, Well, the number is 'locked', because once it's given to you, that's it, it's gone from the 'list of available numbers' (i.e.: the sequence). However, between the insert, and the read of the ID, if another transaction performs an insert, it does

Re: [GENERAL] transaction safety

2001-02-13 Thread DaVinci
On Tue, Feb 13, 2001 at 09:56:18AM -, Michael Ansley wrote: Hi, Well, the number is 'locked', because once it's given to you, that's it, it's gone from the 'list of available numbers' (i.e.: the sequence). However, between the insert, and the read of the ID, if another transaction

RE: [GENERAL] transaction safety

2001-02-13 Thread Michael Ansley
Title: RE: [GENERAL] transaction safety OK, someone want to answer this? I have always been under the impression that Postgres would not block under these circumstances, however, this is clearly blocking, for no apparently good reason. I have just run a test on my own server

[GENERAL] transaction safety

2001-02-12 Thread DaVinci
Hi all. I want to create a new tuple of main info and detail tuples (in different tables) that are joined by a key field. Key field is created by generator automatically and I need that number in order to assign to detail tuples. How can I to get that number in a safe way?. Thanks for

Re: [GENERAL] transaction safety

2001-02-12 Thread Oliver Elphick
DaVinci wrote: Hi all. I want to create a new tuple of main info and detail tuples (in different tables) that are joined by a key field. Key field is created by generator automatically and I need that number in order to assign to detail tuples. How can I to get that number in a

Re: [GENERAL] transaction safety

2001-02-12 Thread DaVinci
On Mon, Feb 12, 2001 at 11:08:55AM +, Oliver Elphick wrote: DaVinci wrote: Hi all. I want to create a new tuple of main info and detail tuples (in different tables) that are joined by a key field. Key field is created by generator automatically and I need that number in

Re: [GENERAL] transaction safety

2001-02-12 Thread DaVinci
On Mon, Feb 12, 2001 at 01:08:01PM -, Michael Ansley wrote: The number returned by the sequence for the serial ID is retained within the session, and so it can be returned by calling currval, e.g.: ...[a detailed example]... Typically, the insert for a person, and for all the

RE: [GENERAL] transaction safety

2001-02-12 Thread Michael Ansley
Title: RE: [GENERAL] transaction safety There should be no locks on the table for insert. The sequence number is retained by the session, not locked on the database. What this means is that somebody else may start their insert after you, and then you roll back, leaving a gap in the sequences

Re: [GENERAL] transaction safety

2001-02-12 Thread Tom Lane
DaVinci [EMAIL PROTECTED] writes: On Mon, Feb 12, 2001 at 01:08:01PM -, Michael Ansley wrote: Typically, the insert for a person, and for all the associated addresses would be done in the same transaction so that if the insert for one of the addresses failed, then the whole lot would role

Re: [GENERAL] transaction safety

2001-02-12 Thread DaVinci
On Mon, Feb 12, 2001 at 10:22:30AM -0500, Tom Lane wrote: DaVinci [EMAIL PROTECTED] writes: On Mon, Feb 12, 2001 at 01:08:01PM -, Michael Ansley wrote: Typically, the insert for a person, and for all the associated addresses would be done in the same transaction so that if the insert