dashjoin / platform

Dashjoin Is an Open Source & Cloud Native Low Code Development and Integration Platform that helps teams deliver applications faster 🚀 Uses a data-driven approach inspired by Linked Data to make use of your existing assets
https://dashjoin.com
GNU Affero General Public License v3.0
89 stars 7 forks source link

Table Prefix is automatically added if there very amigous columns, even if the amigious columns removed by an explicit SELECT #373

Open pgrill79 opened 2 weeks ago

pgrill79 commented 2 weeks ago

I have the following query:

select species.name as "name", species.id as speciesid, count(*) animals from contacttoanimal left join animal on animal.id=contactto left join breed ON breed.id = animal.fk_breed left join species on species.id = breed.fk_species where contactfrom=${clientId} group by species.name, species.id

where the tables animal, breed and specias all have the column "name" - i guess this is the reason why the table prefix is added in the result:

[ { "species.name": "Sheep", "value": 2, "animals": 16 }, { "species.name": "Goat", "value": 3, "animals": 71 } ]

So although in the resultset there are no duplicates anymore (becasue the select clause only selects the name of species), in the resultset the prefix "species." is added. Even if you add an 'as "name"' or surround it with a WITH statement, the prefix is always added.

But because e.g. for the selection of an input field, the property "name" (without prefix) is needed, i need a function to remove the prefix after executing the query.

So it would be good if the prefix is only added if the result really has duplicates (e.g. if i add the column name of species and breed)