Re: autogenerated column names + views are a dump hazard

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: kathy(dot)forte(at)2ndquadrant(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: autogenerated column names + views are a dump hazard
Date: 2015-03-03 16:28:12
Message-ID: 20150303162812.GC12445@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-03-03 11:09:29 -0500, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > On 2015-03-03 09:39:03 -0500, Tom Lane wrote:
> > I think this is the way to go though. There's different extremes we can
> > go to though - the easiest is to simply remove the attname = "?column?"
> > assignment from get_target_list(). That way plain Var references (aside
> > from whole row vars/subplans and such that get_variable() deals with)
> > don't get a forced alias, but everything else does. That seems like a
> > good compromise between readability and safety. get_rule_expr() deals
> > with most of the "nasty" stuff.
>
> I wasn't aware that there was any room for "compromise" on the safety
> aspect.

Meh.

I think that *not* printing an alias for a plain column reference is
reasonable and doesn't present a relevant risk even in the face of
future changes. "foo.bar AS bar" is just a bit too redundant imo.

> That's why I was thinking that relying on the pretty flag might be a
> reasonable thing. pg_dump would be unconditionally right, and we'd
> not uglify EXPLAIN or \d+ output.

I don't think EXPLAIN VERBOSE currently is affected - it doesn't seem to
show aliases/generated column names at all.

I personally do occasionally copy & paste from from \d+ output, so I'd
rather have slightly more verbose output rather than wrong output.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2015-03-03 17:09:29 Re: Idea: closing the loop for "pg_ctl reload"
Previous Message Bruce Momjian 2015-03-03 16:15:13 Re: Maximum number of WAL files in the pg_xlog directory