Hi Anil:
On Wed, Jul 23, 2014 at 11:34 PM, Anil Menon gakme...@gmail.com wrote:
...
. It's that itch to drink deep from the fountain of knowledge.
Beware of hyponatremia, and keep in mind it can change in the future.
But you'll surely learn a lot.
I really do like
Laurenz Albe's advice of
Hi Anil:
On Tue, Jul 22, 2014 at 6:46 PM, Anil Menon gakme...@gmail.com wrote:
Am a bit confused -which one comes first?
1) the 'data'||currval('id01_col1_seq') is parsed first : which means it
or
1) an insert is attempted which causes a sequence.nextval to be performed
...
I observe the
Thanks Olarte,
Exactly following your advice...this being the beauty of open source -you
can read the source code
. It's that itch to drink deep from the fountain of knowledge.
I really do like
Laurenz Albe's advice of using WITH() AS which seems to be the best
practice I can ask the
On Mon, 2014-07-21 at 10:00 +0800, Anil Menon wrote:
Hi,
I have a question on the right/correct practice on using the serial
col's sequence for insert.
Best way of explanation is by an example:
create table id01 (col1 serial, col2 varchar(10));
insert into id01(col2) values
rob stone wrote:
I have a question on the right/correct practice on using the serial
col's sequence for insert.
Best way of explanation is by an example:
create table id01 (col1 serial, col2 varchar(10));
insert into id01(col2) values ( 'data'||
currval('id01_col1_seq')::varchar);
while
Albe Laurenz *EXTERN* wrote
Also, I think that your method is vulnerable to race conditions:
If somebody else increments the sequence between the INSERT and
SELECT lastval() you'd get a wrong value.
Uh, no. It returns that last value issued in the same session - which is
race-proof.
On Tue, 2014-07-22 at 13:32 +, Albe Laurenz wrote:
rob stone wrote:
I have a question on the right/correct practice on using the serial
col's sequence for insert.
Best way of explanation is by an example:
create table id01 (col1 serial, col2 varchar(10));
insert into
On Tuesday, July 22, 2014, rob stone-2 [via PostgreSQL]
ml-node+s1045698n5812384...@n5.nabble.com wrote:
On Tue, 2014-07-22 at 13:32 +, Albe Laurenz wrote:
rob stone wrote:
I have a question on the right/correct practice on using the serial
col's sequence for insert.
Best
David G Johnston wrote:
Also, I think that your method is vulnerable to race conditions:
If somebody else increments the sequence between the INSERT and
SELECT lastval() you'd get a wrong value.
Uh, no. It returns that last value issued in the same session - which is
race-proof.
On Tue, Jul 22, 2014 at 9:46 AM, Anil Menon gakme...@gmail.com wrote:
Am a bit confused -which one comes first?
1) the 'data'||currval('id01_col1_seq') is parsed first : which means it
takes the current session's currval
2) then the insert is attempted which causes a sequence.nextval to be
Am a bit confused -which one comes first?
1) the 'data'||currval('id01_col1_seq') is parsed first : which means it
takes the current session's currval
2) then the insert is attempted which causes a sequence.nextval to be
performed which means that 'data'||currval('id01_col1_seq')will be
different
Hi,
I have a question on the right/correct practice on using the serial col's
sequence for insert.
Best way of explanation is by an example:
create table id01 (col1 serial, col2 varchar(10));
insert into id01(col2) values ( 'data'||currval('id01_col1_seq')::varchar);
while I do get what I
12 matches
Mail list logo