Re: [HACKERS] column aliases

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] column aliases
Date: 2000-01-23 17:45:07
Message-ID: 3.0.1.32.20000123094507.01053430@mail.pacifier.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 11:12 AM 1/23/00 -0500, Tom Lane wrote:

>What it looks like to me is that we have a bug in the expansion of '*'.
>It should be generating columns for both the explicit and the implicit
>FROM clause, but it's evidently deciding that it should only produce
>output columns for the first one.

Yes, since it is joining the two tables it should be returning all
columns of the join.

>This may go a long way towards explaining why people have been so
>readily confused by the implicit-FROM-clause business!

It *is* confusing, that's for sure!

> If they saw
>two sets of columns coming out, it'd be more obvious that they were
>getting a join.
>
>> Does the standard say the first query is legal?
>
>I believe it is not strict SQL92 --- we've been around on that question
>before.

Is this feature something many folks depend upon? It appears that at
least some of the folks who hang out on this list aren't entirely
clear on this implicit "from" clause thing - if that's true, how
many users who are out of the loop understand it?

It isn't that burdensome to explictly list a table again in the from
list. The query's certainly more readable and portable for folks who
are (say) trying to port PostgreSQL-based stuff to (say) Oracle.

On the other hand, if a lot of folks depend on this (somewhat dubious,
IMHO) feature then I suppose it should be preserved - with "*" expansion
fixed, presumably!

- Don Baccus, Portland OR <dhogaza(at)pacifier(dot)com>
Nature photos, on-line guides, Pacific Northwest
Rare Bird Alert Service and other goodies at
http://donb.photo.net.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-01-23 17:55:36 Re: pg_dump possible fix, need testers. (was: Re: [HACKERS] pg_dump disaster)
Previous Message Jeroen van Vianen 2000-01-23 16:56:12 Implementing STDDEV and VARIANCE