with queries - Mailing list pgsql-sql

From Greg Quinn
Subject with queries
Date
Msg-id 4C91A58C.7050406@anu.edu.au
Whole thread Raw
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Tatarnikov Alexander
Date:
Subject: Re: Use "CREATE USER" in plpgsql function - Found word(s) list error in the Text body
Next
From: Greg Quinn
Date:
Subject: with queries