Re: SQL feature requests

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, <pgsql-hackers(at)postgresql(dot)org>, "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>, "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>, "Josh Berkus" <josh(at)agliodbs(dot)com>
Subject: Re: SQL feature requests
Date: 2007-08-24 15:51:49
Message-ID: 8764350w2y.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Gregory Stark <stark(at)enterprisedb(dot)com> writes:
>
>> Note that if you use something like fetchrow_hashref it will actually condense
>> out duplicate column names since it loads the row into a hash. So if you
>> you're writing a program which just wants to dump the record without
>> understanding it you probably load it into a hash and then dump the hash in
>> key=>value form. And that will cause some columns to be dropped in the output.
>
>> But those people probably just figure it was their own fault and put in
>> aliases in their queries.
>
> Well, if you're using client-side code that depends on access by name
> rather than field position, you definitely have to put in AS clauses.
> Even if we did generate distinct names, a client couldn't rely on
> knowing in advance what they'd be.

That's why I got tied up trying to describe a scenario where you wouldn't have
to rely on knowing in advance what they would be. If you're running some kind
of reporting tool it could let the user type in arbitrary queries and then
look at what names are returned from the describe message to put in its column
headings.

If such a tool was written in perl using fetchrow_hashref I think it would end
up receiving only one of each distinct column name. Whereas it should be able
to depend on receiving all of them with distinct names, even if it won't know
what those names will be in advance.

If it's written to use arrays and column positions then it would still work
properly though. And we haven't seen any real complaints.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2007-08-24 15:53:37 Re: Final background writer cleanup for 8.3
Previous Message Tom Lane 2007-08-24 15:24:53 Re: Final background writer cleanup for 8.3