Re: autogenerated column names + views are a dump hazard - Mailing list pgsql-hackers

From Andres Freund
Subject Re: autogenerated column names + views are a dump hazard
Date
Msg-id 20150303162812.GC12445@alap3.anarazel.de
Whole thread Raw
In response to Re: autogenerated column names + views are a dump hazard  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2015-03-03 11:09:29 -0500, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.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



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Maximum number of WAL files in the pg_xlog directory
Next
From: Jim Nasby
Date:
Subject: Re: Idea: closing the loop for "pg_ctl reload"