pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jeff.janes@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14505: explain verbose for postgresql_fdw
Date: Wed, 18 Jan 2017 23:43:59 +0000
Message-ID: <20170118234359.1430.69705@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      14505
Logged by:          Jeff Janes
Email address:      jeff.janes@gmail.com
PostgreSQL version: 9.6.1
Operating system:   Linux (CentOS)
Description:        

The "Output:" line of explain verbose lists columns of foreign table that
are not actually output, or at least ought not be output.  This extends back
to at least 9.4 as well

explain verbose select local12,a3 from local1 join remote4 on (foobar=a7);

                       QUERY PLAN
-------------------------------------------------------------------------
 Hash Join  (cost=121.25..242.85 rows=2325 width=70)
   Output: local1.local12, remote4.a3
   Hash Cond: (remote4.a7 = local1.foobar)
   ->  Foreign Scan on public.remote4  (cost=100.00..137.90 rows=930
width=64)
         Output: remote4.id, remote4.code, remote4.a1, remote4.a2,
remote4.a3, remote4.a4, remote4.a5, remote4.a6, remote4.a7, remote4.a8,
remote4.a9
         Remote SQL: SELECT a3, a7 FROM remote.remote4
   ->  Hash  (cost=15.00..15.00 rows=500 width=70)
         Output: local1.local12, local1.foobar
         ->  Seq Scan on public.local1  (cost=0.00..15.00 rows=500
width=70)
               Output: local1.local12, local1.foobar


If the remote SQL only selects a3 and a7, how can all columns be output?

Full reproduction:


drop database foobar;
create database foobar;
\c foobar

CREATE EXTENSION IF NOT EXISTS postgres_fdw WITH SCHEMA public;

CREATE SERVER remote_server FOREIGN DATA WRAPPER postgres_fdw options
(dbname 'foobar') ;
CREATE USER MAPPING FOR postgres SERVER remote_server OPTIONS (
    "user" 'postgres'
);

CREATE TABLE local1 (
    local12 character varying(40) NOT NULL,
    foobar text,
    local13 text,
    local19 text
);

CREATE schema remote;

CREATE TABLE remote.remote4 (
    id bigint NOT NULL,
    code character varying(255) NOT NULL,
    a1 text,
    a2 text,
    a3 text,
    a4 text,
    a5 text,
    a6 text,
    a7 text,
    a8 text,
    a9 text
);

CREATE FOREIGN TABLE remote4 (
    id bigint NOT NULL,
    code character varying(255) NOT NULL,
    a1 text,
    a2 text,
    a3 text,
    a4 text,
    a5 text,
    a6 text,
    a7 text,
    a8 text,
    a9 text
)
SERVER remote_server
OPTIONS (
    schema_name 'remote',
    table_name 'remote4'
);

explain verbose select local12,a3 from local1 join remote4 on (foobar=a7);

-- doesn't happen on local table

explain verbose select local12,a3 from local1 join remote.remote4 on
(foobar=a7);



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


view thread (4+ messages)  latest in thread

Message-ID: <20170118234359.1430.69705@wrigleys.postgresql.org>
Permalink:  ../20170118234359.1430.69705@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20170118234359.1430.69705@wrigleys.postgresql.org

 · 

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: jeff.janes@gmail.com
  Subject: Re: BUG #14505: explain verbose for postgresql_fdw
  In-Reply-To: <20170118234359.1430.69705@wrigleys.postgresql.org>
  References: <20170118234359.1430.69705@wrigleys.postgresql.org>

* 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