Hi Anil:
On Wed, Jul 23, 2014 at 11:34 PM, Anil Menon 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 using WITH() AS w
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 devel
Hi Anil:
On Tue, Jul 22, 2014 at 6:46 PM, Anil Menon 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 latter on my
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
On Tue, Jul 22, 2014 at 9:46 AM, Anil Menon 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
> performed whi
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 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 ins
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));
> >>
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.
http
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')::
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(c
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 want
12 matches
Mail list logo