Bug #6215
closedSQL extension: returning the results of a join query
100%
Description
The data returned from a call on SQL extensions using a join query between two tables with common column names appears to be incomplete: see https://stackoverflow.com/questions/77243137
Updated by Michael Kay about 1 year ago
- Status changed from New to In Progress
Sorry about the delay. I have finally got around to re-establishing a test environment where I can debug this.
First thing is, I've established that (at least with PostgresSQL), with a query of the form
SELECT date AS date2, price AS price2 FROM book WHERE author = ?'
the current code (which calls resultSetMetaData.getColumnName()
) is in fact using "date2" and "price2" as the column labels. Using resultSetMetaData.getColumnLabel()
gives exactly the same result.
Updated by Michael Kay about 1 year ago
Next experiment, if I give both columns the same AS name, it doesn't complain and just returns a map in which one of the fields (the first one) is missing (because of course the duplicate name has overridden it).
Updated by Len Schultz about 1 year ago
I noticed the same thing with MySQL. With one table or joins of unique tables with unique column names, I can use AS to rename a column.
Updated by Michael Kay about 1 year ago
- Status changed from In Progress to Resolved
- Applies to branch 12, trunk added
- Fix Committed on Branch 12, trunk added
I have added some test cases that establish the "AS" column name is used when available; and I have changed the code so that a unique key name is generated in the result map if the supplied column names are not unique.
Updated by O'Neil Delpratt about 1 year ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 12.4 added
Bug fix applied in the Saxon 12.4 maintenance release
Please register to edit this issue