Can I distinguish identically named columns in joined tables?

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Can I distinguish identically named columns in joined tables?
Дата
Msg-id 199808221658.RAA22925@linda.lfix.co.uk
обсуждение исходный текст
Список 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.Elphick@lfix.co.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



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Minor bug: inconsistent handling of overlength names
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Minor bug: inconsistent handling of overlength names