ws4sqlite icon indicating copy to clipboard operation
ws4sqlite copied to clipboard

Confusing results if duplicate fields names in map results

Open blaix opened this issue 9 months ago • 1 comments

If you have a query with a join and the field names aren't unique, you get confusing results:

For example:

select foo.id, bar.id from foo inner join bar on (foo.id = bar.foo_id)

results in:

"resultHeaders": ["id", "id"],
"resultSet": [{ "id": 2 }]

The solution is to make sure you alias fields with unique names, or use "resultFormat": "list". But if you do use map and have duplicate fields, the result isn't very usable since there is lost data and ambiguous field names, so perhaps it should raise an error?

blaix avatar Mar 12 '25 16:03 blaix

Agreed, as discussed on Discord. Thanks for the report.

This will be done in ws4sql, that will be released as soon as I complete the documentation.

proofrock avatar Mar 12 '25 16:03 proofrock