Re: issue with SELECT settval(..);

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: Christian Schröder <cs(at)deriva(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: issue with SELECT settval(..);
Date: 2007-03-19 11:20:55
Message-ID: 45FE7217.9000604@magproductions.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)magproductions(dot)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 //

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ezequias R. da Rocha 2007-03-19 11:35:57 Client/Server [max connections]
Previous Message Elena 2007-03-19 10:30:40 Reference Type in PostgreSQL