except all & WITH - syntax error?

From: pinker <pinker(at)onet(dot)eu>
To: pgsql-general(at)postgresql(dot)org
Subject: except all & WITH - syntax error?
Date: 2018-07-02 14:25:01
Message-ID: 1530541501991-0.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!
Something strange happened to me right now. I'm trying to compare results
from one query with rewritten version and everything is ok with this order:

WITH abc AS (SELECT 1) SELECT 1
except all
SELECT 1

but when I'm trying other way around it throws an error:
SELECT 1
except all
WITH abc AS (SELECT 1) SELECT 1

ERROR: syntax error at or near "WITH" LINE 3: WITH abc AS (SELECT 1) SELECT
1 ^ SQL state: 42601 Character: 21

"PostgreSQL 9.6.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
20150623 (Red Hat 4.8.5-16), 64-bit"

Is this expected behaviour?
It's much harder to optimize queries without this option.

--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marco Fochesato 2018-07-02 14:51:42 Not able to update some rows in a table
Previous Message Melvin Davidson 2018-07-02 14:21:26 Re: Cloning schemas