Re: Subselects not allowed? - Mailing list pgsql-sql

From Tom Lane
Subject Re: Subselects not allowed?
Date
Msg-id 15640.1307805261@sss.pgh.pa.us
Whole thread Raw
In response to Re: Subselects not allowed?  (Guillaume Lelarge <guillaume@lelarge.info>)
Responses Re: Subselects not allowed?  (Leif Biberg Kristensen <leif@solumslekt.org>)
List pgsql-sql
Guillaume Lelarge <guillaume@lelarge.info> writes:
> On Sat, 2011-06-11 at 17:01 +0200, Leif Biberg Kristensen wrote:
>> Can anybody tell me why this doesn't work?
>> pgslekt=> CREATE SEQUENCE sources_source_id_seq START WITH (SELECT 
>> MAX(source_id) FROM sources);
>> ERROR:  syntax error at or near "("

> Because it's not supported. The START clause expects a value, not a
> subquery.

More generally, there are no "utility" statements in PG that accept
non-constant expressions in their parameters.  (A utility statement is
anything other than SELECT, INSERT, UPDATE, DELETE.)

There's been occasional speculation about changing that, but it would
take a significant amount of work I think.
        regards, tom lane


pgsql-sql by date:

Previous
From: Guillaume Lelarge
Date:
Subject: Re: Subselects not allowed?
Next
From: Andreas Kretschmer
Date:
Subject: Re: Subselects not allowed?