Re: Are multiple selects of the same field allowed - Mailing list pgsql-odbc

From Kristis Makris
Subject Re: Are multiple selects of the same field allowed
Date
Msg-id 1014219388.1044.122.camel@leonidas
Whole thread Raw
In response to Re: Are multiple selects of the same field allowed  (Hiroshi Inoue <Inoue@tpf.co.jp>)
List pgsql-odbc
>
> Hmm both field have the same field name "id" and the driver
> couldn't distinguish them. Couldn't you change the query like
>   "select id, id as id2 from WaterResourec"
> ?
>

I certainly could, at a great inconvinience of modifying sources of a
huge application that was behaving "normally" so far. I noticed that the
command-line psql client succesfully reports a column's value twice if
instructed to do so:

# select usesysid, usesysid from pg_user;
 usesysid | usesysid
----------+----------
       26 |       26
       27 |       27
       33 |       33
...

How is that implementation different from what I'm trying to achieve
using the .GetField() function? In other languages (e.g. perl using
DBD:Pg) it is possible to get a result of a row, and index in it the
column whose data are to be retrieved. Can't the GetField() be
implemented to function internally in a similar fashion where it marks
which column names it has "visited" already so it moves to the next in
the case of duplicate column names? Or most importantly, why was the
v7.01.0008 driver handling this correctly, while v7.01.0010 isn't? Was a
significant change in an attempt to remain ODBC compliant (or similar)
made that would absolutely, 100% forbid using .GetField() twice on the
same field name? Why is there such a restriction now all of the sudden,
and is that restriction necessary?

Thanks,
-Kristis


pgsql-odbc by date:

Previous
From: Jean-Michel POURE
Date:
Subject: Re: [HACKERS] UTF-8 data migration problem in Postgresql 7.2
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] UTF-8 data migration problem in Postgresql 7.2