Re: Request for qualified column names

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Request for qualified column names
Дата
Msg-id 18781.1043631518@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Request for qualified column names  (Dave Cramer <dave@fastcrypt.com>)
Ответы Re: Request for qualified column names  ("Reggie Burnett" <rykr@bellsouth.net>)
Список pgsql-hackers
Dave Cramer <dave@fastcrypt.com> writes:
> So for a "select a, b, a+b as sum from c" returns c.a, c.b, ?table?.sum

This might be something to consider as part of the planned protocol
overhaul.  We cannot simply change the returned column names --- at
least not without breaking a lot of application code.  But if we
return table name (and schema name too!) as separate fields of the
'T' message, and make them accessible through new PQfoo accessor
functions, then no existing applications would break.

But there are more than a few definitional issues to be settled before
you'll convince me this idea is fully baked.  Some things that come to
mind immediately:

What happens with views?  Givencreate view v as select col as vcol from tab;select vcol from v;
are you expecting to get back "v.vcol"?  Or "tab.col"?

What happens with FROM-clause aliases?  Supposing tab really has a
column "col", what do you expect to see fromselect * from tab AS a(t1), tab AS b(t2) WHERE ...
You could make a case for either "tab.col, tab.col" or "a.t1, b.t2"
(in the latter case, you can't realistically return a schema name).
But you will probably break existing code if you do the former, since
currently the output columns are labeled t1, t2.

What happens with join aliases (similar issues to above)?

Do you thinkselect col as foo from tab
should return "tab.foo", or just "foo"?  I'd lean to the latter;
"tab.foo" seems awfully misleading.  Or maybe you're wanting it
to ignore the AS and return "tab.col"?  Don't think that will fly.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: Re: Sorting Chinese data in Postgresql 7.3.1
Следующее
От: Justin Clift
Дата:
Сообщение: Re: [CYGWIN] Have a PG 7.3.1 Windows (cygwin) easy installer... now