Re: [SQL] serial column vs. explicit sequence question

2002-06-13 Thread Stephan Szabo
On Thu, 13 Jun 2002, Charlie Toohey wrote: > If session A and session B are concurrently doing the same master-detail > transaction, wouldn't currval possibly reflect the sequence value used by the > other session ? Or are you saying that since this will be an explicit > transaction that currval

Re: [SQL] serial column vs. explicit sequence question

2002-06-13 Thread Charlie Toohey
that definitely helps ! thank you Jason --- the key thing that I didn't undertand, and you have now enlightened me, is that currval was connection dependent --- I didn't think this would be guaranteed to work with concurrent transactions, but now I understand. Just prior to receiving your mess

Re: [SQL] serial column vs. explicit sequence question

2002-06-13 Thread Jason Earl
Charlie Toohey <[EMAIL PROTECTED]> writes: > I'm having a problem and there seems to be 2 solutions. It is simple > and straighforward, but will take several paragraphs to explain. > > I have a schema with a master-detail design. The master table does > not have an expicit id, so I have a column

Re: [SQL] serial column vs. explicit sequence question

2002-06-13 Thread Charlie Toohey
If session A and session B are concurrently doing the same master-detail transaction, wouldn't currval possibly reflect the sequence value used by the other session ? Or are you saying that since this will be an explicit transaction that currval won't reflect the fact that the sequence may have

Re: [SQL] serial column vs. explicit sequence question

2002-06-13 Thread Tom Lane
Charlie Toohey <[EMAIL PROTECTED]> writes: > A better solution would seem to use a sequence explicitly, rather than a id > column of type serial. I would obtain the id value from the sequence, and > then insert this id into the master table and into the detail table. Yup. But there's no need t

Re: [SQL] serial column vs. explicit sequence question

2002-06-13 Thread Josh Berkus
Charlie, > Lets say I need to insert a row into the master table and N rows into the > detail table. After inserting a row into master, and before detail, I need to > read the master table to obtain the value of the id for the row just > inserted, so I can insert this id as the foreign key v

Re: [SQL] serial column vs. explicit sequence question

2002-06-13 Thread Stephan Szabo
On Thu, 13 Jun 2002, Charlie Toohey wrote: > I'm having a problem and there seems to be 2 solutions. It is simple and > straighforward, but will take several paragraphs to explain. > > I have a schema with a master-detail design. The master table does not have > an expicit id, so I have a column

[SQL] serial column vs. explicit sequence question

2002-06-13 Thread Charlie Toohey
I'm having a problem and there seems to be 2 solutions. It is simple and straighforward, but will take several paragraphs to explain. I have a schema with a master-detail design. The master table does not have an expicit id, so I have a column of type serial. Lets say I need to insert a row i