pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: pgsql-bugs@lists.postgresql.org
Cc: maxim.boguk@gmail.com, rhaas@postgresql.org, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Subject: Re: BUG #15352: postgresql FDW error "ERROR: ORDER BY position 0 is not in select list"
Date: Sat, 25 Aug 2018 18:12:58 +0100
Message-ID: <87a7paz8b1.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <87efemzw0v.fsf@news-spur.riddles.org.uk>
References: <153518420278.1478.14875560810251994661@wrigleys.postgresql.org>
	<87efemzw0v.fsf@news-spur.riddles.org.uk>

>>>>> "Andrew" == Andrew Gierth <andrew@tao11.riddles.org.uk> writes:

 Andrew> So what's happening here is that there's an equivalence class
 Andrew> containing members
 Andrew> "greatest(pg_catalog.pg_stat_user_tables.idx_scan,
 Andrew> public.pg_stat_user_tables.idx_scan)" and "0" (as an integer
 Andrew> constant), and somehow a pathkey for this eclass is becoming
 Andrew> attached to the query going to the remote for statistics
 Andrew> purposes.

 Andrew> It seems obviously wrong that a constant pathkey with no actual
 Andrew> reference to the foreign table should be being pushed down, so
 Andrew> so far I suspect that get_useful_pathkeys_for_relation isn't
 Andrew> being selective enough about what is "useful". In this context
 Andrew> I find it suspicious that find_em_expr_for_rel will return an
 Andrew> expr with no vars as being "for" every rel, since it's just
 Andrew> looking for a subset.

So this looks to me like an oversight in aa09cd242 (CCing rhaas and
Ashutosh accordingly), which changed find_em_expr_for_rel from using
bms_equal to bms_is_subset without considering the degenerate case of
members with no relids at all. I propose to simply add a !bms_is_empty
condition there; anyone have any better idea?

-- 
Andrew (irc:RhodiumToad)




view thread (10+ messages)  latest in thread

Message-ID: <87a7paz8b1.fsf@news-spur.riddles.org.uk>
Permalink:  ../87a7paz8b1.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/87a7paz8b1.fsf@news-spur.riddles.org.uk

 · 

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-bugs@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, ashutosh.bapat@enterprisedb.com
  Subject: Re: BUG #15352: postgresql FDW error "ERROR: ORDER BY position 0 is not in select list"
  In-Reply-To: <87a7paz8b1.fsf@news-spur.riddles.org.uk>
  References: <153518420278.1478.14875560810251994661@wrigleys.postgresql.org> <87efemzw0v.fsf@news-spur.riddles.org.uk> <87a7paz8b1.fsf@news-spur.riddles.org.uk>

* 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