pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pinker <pinker@onet.eu>
To: pgsql-general@postgresql.org
Subject: except all & WITH - syntax error?
Date: Mon, 2 Jul 2018 07:25:01 -0700 (MST)
Message-ID: <1530541501991-0.post@n3.nabble.com> (raw)

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




view thread (4+ messages)  latest in thread

Message-ID: <1530541501991-0.post@n3.nabble.com>
Permalink:  ../1530541501991-0.post@n3.nabble.com/
Also on:    postgresql.org/message-id/1530541501991-0.post@n3.nabble.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: pinker@onet.eu
  Subject: Re: except all & WITH - syntax error?
  In-Reply-To: <1530541501991-0.post@n3.nabble.com>
  References: <1530541501991-0.post@n3.nabble.com>

* 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