Re: issue with SELECT settval(..); - Mailing list pgsql-general

From Alban Hertroys
Subject Re: issue with SELECT settval(..);
Date
Msg-id 45FE7217.9000604@magproductions.nl
Whole thread Raw
In response to Re: issue with SELECT settval(..);  (Christian Schröder <cs@deriva.de>)
List pgsql-general
Christian Schröder wrote:
> Alain Roger wrote:
>> insert into immense.statususer (statususer_id, statususer_type) values
>> (SELECT nextval( 'statususer_statususer_id_seq' ),'customer');
> The correct syntax would be:
>
> insert into immense.statususer (statususer_id, statususer_type) values
> ((SELECT nextval( 'statususer_statususer_id_seq' )),'customer');

Well, that original query was almost right, it just didn't need the
values statement and the parenthesis:

 insert into immense.statususer (statususer_id, statususer_type)
 SELECT nextval('statususer_statususer_id_seq'), 'customer';

But as mentioned; using nextval directly is better.
--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //


pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: planning issue
Next
From: "Ezequias R. da Rocha"
Date:
Subject: Client/Server [max connections]