pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Cristian Cruz <danielcristian@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6050: Dump and restore of view after a schema change: can't restore the view
Date: Tue, 7 Jun 2011 12:43:37 -0300
Message-ID: <BANLkTika92geQx5rfaAqhs2PvSMMdkg+oQ@mail.gmail.com> (raw)
In-Reply-To: <BANLkTi=nPQoo2x3grhBxoaH0QjWjH9E_9Q@mail.gmail.com>
References: <201106031238.p53CcA8P075374@wwwmaster.postgresql.org>
	<27042.1307113140@sss.pgh.pa.us>
	<BANLkTikhmPtzZQNPPJ7vfsaHsEq8e5Sc-Q@mail.gmail.com>
	<1357.1307121567@sss.pgh.pa.us>
	<BANLkTikc=5ajmmKNaE3H6Qo-hng1LyHcUw@mail.gmail.com>
	<2768.1307125285@sss.pgh.pa.us>
	<BANLkTi=nPQoo2x3grhBxoaH0QjWjH9E_9Q@mail.gmail.com>

But as a PostgreSQL user, I would like to had a warning when creating a view
with USING. It solves my problem. Maybe many others too.

2011/6/7 Robert Haas <robertmhaas@gmail.com>

> On Fri, Jun 3, 2011 at 2:21 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Robert Haas <robertmhaas@gmail.com> writes:
> >> On Fri, Jun 3, 2011 at 1:19 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >>> Now, if the query doesn't involve any explicit reference to
> "joinalias.*",
> >>> we could probably fake it with some ugly thing involving
> >>> COALESCE(leftcol, rightcol) ... but I don't think people will want to
> >>> read that, and anyway the idea falls apart as soon as you do have a
> >>> whole-row reference.
> >
> >> Well, it gets internally translated to COALESCE(leftcol, rightcol)
> >
> > We do that during planning; it's not the form that gets stored in views
> > or dumped by pg_dump.  I don't really want pg_dump dumping this kind of
> > thing, because that locks us down to supporting it that way forever.
>
> Hmm.
>
> >> I'm not seeing the problem with whole-row references; can you elaborate
> on that?
> >
> > SELECT somefunc(j.*) FROM (tab1 JOIN tab2 USING (id)) j;
> >
> > The shape of the record passed to somefunc() depends on removal of the
> > second id column.
>
> Ah, yes.
>
> > Now you might claim that we could expand the j.* to a ROW() construct
> > with an explicit list of columns, which indeed is what happens
> > internally.  But again, that happens at plan time, it's not what gets
> > stored in rules.  And that matters, because locking down the column
> > expansion too early would break the response to ADD/DROP COLUMN on
> > one of the input tables.
>
> Fair enough, but the current implementation with respect to ADD
> COLUMN.  And RENAME COLUMN.
>
> If your point here is that you don't want to spend time hacking on
> this because it's a fairly marginal feature and therefore not terribly
> high on your priority list, I can understand that.  But if you're
> actually defending the current implementation, I'm going to have to
> respectfully disagree.  It's broken, and it sucks, and this is not the
> first complaint we've had about it.
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>



-- 
Daniel Cristian Cruz
クルズ クリスチアン ダニエル

view thread (22+ messages)  latest in thread

Message-ID: <BANLkTika92geQx5rfaAqhs2PvSMMdkg+oQ@mail.gmail.com>
Permalink:  ../BANLkTika92geQx5rfaAqhs2PvSMMdkg+oQ@mail.gmail.com/
Also on:    postgresql.org/message-id/BANLkTika92geQx5rfaAqhs2PvSMMdkg+oQ@mail.gmail.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-bugs@postgresql.org
  Cc: danielcristian@gmail.com, robertmhaas@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: BUG #6050: Dump and restore of view after a schema change: can't restore the view
  In-Reply-To: <BANLkTika92geQx5rfaAqhs2PvSMMdkg+oQ@mail.gmail.com>
  References: <201106031238.p53CcA8P075374@wwwmaster.postgresql.org> <27042.1307113140@sss.pgh.pa.us> <BANLkTikhmPtzZQNPPJ7vfsaHsEq8e5Sc-Q@mail.gmail.com> <1357.1307121567@sss.pgh.pa.us> <BANLkTikc=5ajmmKNaE3H6Qo-hng1LyHcUw@mail.gmail.com> <2768.1307125285@sss.pgh.pa.us> <BANLkTi=nPQoo2x3grhBxoaH0QjWjH9E_9Q@mail.gmail.com> <BANLkTika92geQx5rfaAqhs2PvSMMdkg+oQ@mail.gmail.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