Search Postgresql Archives

Return keys for values with dot-separation in joined statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

writing a client frontend I started with mysql and migrated to postgres. Now I found out that there is a difference in the way joined queries are returned:

The query

SELECT persons.id,persons.lastname,persons.firstname,persons.salutation,persons.title,addresses.address1,addresses.address2,addresses.city,addresses.zip FROM persons LEFT JOIN addresses_reference ON persons.id=addresses_reference.refid_persons LEFT JOIN addresses ON addresses_reference.refid_addresses=addresses.id   LIMIT 106 OFFSET 0

The response from postgres in the API:

    address1 = "";
    address2 = "";
    city = "";
    firstname = Olaf;
    id = 5;
    lastname = Taschenbier;
    salutation = Frau;
    title = "";
    zip = "";

The response from mysql:

    persons.address1 = "";
    persons.address2 = "";
    persons.city = "";
    persons.firstname = Olaf;
    persons.id = 5;
    persons.lastname = Taschenbier;
    persons.salutation = Frau;
    persons.title = "";
    persons.zip = "";


This is especially an issue in cases where two tables do have identical fieldnames. What happens in such cases?

Is there a way or some setting on postgres server to tell postgres to use the fieldnames exactly as provided in the select?

Thanks
Alex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux