pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Quinn <greg.quinn@anu.edu.au>
To: pgsql-sql@postgresql.org
Subject: with queries
Date: Thu, 16 Sep 2010 15:05:16 +1000
Message-ID: <4C91A58C.7050406@anu.edu.au> (raw)

Hullo.

I've been a Postgresql user for many years, so forgive me if I'm doing 
something really stupid.

I cannot get 'with' queries to work at all. The test query that I've 
entered below (as an example) is direct from the section '7.8 WITH 
Queries' of the manual, so I'd expect that to work wouldn't I?

test=# WITH RECURSIVE t(n) AS (VALUES (1) UNION ALL SELECT n+1 FROM t 
WHERE n < 100) SELECT sum(n) FROM t;
ERROR:  syntax error at or near "WITH RECURSIVE"
LINE 1: WITH RECURSIVE t(n) AS (VALUES (1) UNION ALL SELECT n+1 FROM...
        ^
test=#

Tried this with 8.4 and 9.0rc1, same result. Any help (even to tell me 
that I'm an idiot!) would be much appreciated. In the meantime my query 
will revert to Plan A, but it would be so much neater using a 'with'.

-- 

Greg Quinn

Australian Phenomics Facility
greg.quinn@anu.edu.au

(02) 61259407




view thread (2+ messages)  latest in thread

Message-ID: <4C91A58C.7050406@anu.edu.au>
Permalink:  ../4C91A58C.7050406@anu.edu.au/
Also on:    postgresql.org/message-id/4C91A58C.7050406@anu.edu.au

 · 

reply

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: greg.quinn@anu.edu.au
  Subject: Re: with queries
  In-Reply-To: <4C91A58C.7050406@anu.edu.au>

* 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