Relation ordering in FROM clause causing error related to missing entry... Or not.

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Relation ordering in FROM clause causing error related to missing entry... Or not.
Date: 2015-03-10 13:05:57
Message-ID: CAB7nPqT9y-zmEzvj-SEsu76w78Cdwdj_531C5YuE6MfRK7ac7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Today while playing with some queries I bumped into the following thing:
=# with count_query as (select generate_series(0,1) as a) select b
from count_query, generate_series(1, count_query.a) as b;
b
---
1
(1 row)
=# with count_query as (select generate_series(0,1) as a) select b
from generate_series(1, count_query.a) as b, count_query;
ERROR: 42P01: missing FROM-clause entry for table "count_query"
LINE 1: ...eries(0,1) as a) select b from generate_series(1, count_quer...
^
LOCATION: errorMissingRTE, parse_relation.c:2850

I have been a little bit surprised by the fact that different entry
ordering in the FROM clause of the main query had different effects.
Perhaps there is something I am missing? I haven't looked at the code
but if this happens to be a bug I am fine to submit a patch.
Regards,
--
Michael

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kohei KaiGai 2015-03-10 13:28:56 Re: One question about security label command
Previous Message Michael Paquier 2015-03-10 12:55:12 Re: [REVIEW] Re: Compression of full-page-writes