Can I distinguish identically named columns in joined tables?

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Can I distinguish identically named columns in joined tables?
Date: 1998-08-22 16:58:02
Message-ID: 199808221658.RAA22925@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Problem with libpq in PostgreSQL 6.3.2:

I have a query that combines 2 tables, each with a column named id:

select a.*, b.* from organisation as a, individual as b
where a.contact = b.id

I am finding that libpq is unable to distinguish between the two id columns,
because the 'a.' and 'b.' are apparently dropped by the backend before the
data is returned. I could get the columns by number, or by explicitly
renaming columns, but that would require an awkward lack of flexibility
in the application.

Is this easy to fix? Is it desirable to fix it from the project's point
of view? I know that column headings would be more awkward, but the
front end could easily strip those...

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"For yourselves know perfectly that the day of the Lord
so cometh as a thief in the night. For when they shall
say, Peace and safety; then sudden destruction cometh
upon them, as travail upon a woman with child; and
they shall not escape." I Thessalonians 5:2,3

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-08-22 21:15:01 Re: [HACKERS] Minor bug: inconsistent handling of overlength names
Previous Message Michael Meskes 1998-08-22 16:09:34 Re: [HACKERS] initdb problem