From: Tom Lane <tgl@sss.pgh.pa.us>
To: Guillaume Lelarge <guillaume@lelarge.info>
Cc: Leif Biberg Kristensen <leif@solumslekt.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: Subselects not allowed?
Date: Sat, 11 Jun 2011 11:14:21 -0400
Message-ID: <15640.1307805261@sss.pgh.pa.us> (raw)
In-Reply-To: <1307804893.25444.5.camel@laptop>
References: <201106111701.54145.leif@solumslekt.org>
<1307804893.25444.5.camel@laptop>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, guillaume@lelarge.info, leif@solumslekt.org
Subject: Re: Subselects not allowed?
In-Reply-To: <15640.1307805261@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox