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

From Christian Schröder
Subject Re: issue with SELECT settval(..);
Date
Msg-id 45FC82AF.3000605@deriva.de
Whole thread Raw
In response to issue with SELECT settval(..);  ("Alain Roger" <raf.news@gmail.com>)
Responses Re: issue with SELECT settval(..);  ("Alain Roger" <raf.news@gmail.com>)
Re: issue with SELECT settval(..);  (Alban Hertroys <alban@magproductions.nl>)
List pgsql-general
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');

The sub-select must be put in parentheses. However, the much simpler
statement

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

will do the same without a sub-select.

Regards
    Christian

--
Deriva GmbH                         Tel.: +49 551 489500-42
Financial IT and Consulting         Fax:  +49 551 489500-91
Hans-Böckler-Straße 2                  http://www.deriva.de
D-37079 Göttingen

Deriva CA Certificate: http://www.deriva.de/deriva-ca.cer


pgsql-general by date:

Previous
From: "Tomi N/A"
Date:
Subject: Re: Postgres Database size
Next
From: Bob Hartung
Date:
Subject: Re: [PHP] works at command line but not in apache