Issue Details (XML | Word | Printable)

Key: JDBC-391
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Mark Rotteveel
Reporter: Mark Rotteveel
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
Jaybird JCA/JDBC Driver

SELECT statements are processed for getGeneratedKeys by appending RETURNING (+ all columnnames)

Created: 20/Apr/15 06:20 PM   Updated: 31/May/15 02:37 PM
Component/s: JDBC driver
Affects Version/s: Jaybird 2.2, Jaybird 2.2.1, Jaybird 2.2.2, Jaybird 2.2.3, Jaybird 2.2.4, Jaybird 2.2.5, Jaybird 2.2.6, Jaybird 2.2.7
Fix Version/s: Jaybird 2.2.8, Jaybird 3.0.0

 Description  « Hide
The generated keys implementation assumes that the parser throws an exception on SELECT queries, and would then proceed executing the query normally. Unfortunately the parser doesn't throw an exception on a SELECT, and instead it processes the query by appending `RETURNING` + all columns in the database (which seems to be another bug in and of itself).

There are currently no tests that check the assumption that SELECT is treated unmodified.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 20/Apr/15 07:19 PM
Added initial test that demonstrates this is broken.

Mark Rotteveel added a comment - 27/Apr/15 02:08 PM
Errors during parsing are now checked, and if there have been parser errors, or if no table name was found, then the query is executed as if it isn't a generated keys query. This fixes this problem (and some related issues).


Mark Rotteveel added a comment - 27/Apr/15 02:34 PM
On further examination the parser intentionally ignores parser errors so it only has to process the first part of the query, and doesn't need to process the full statement.

Mark Rotteveel added a comment - 27/Apr/15 02:57 PM
Removed check for parser errors, the grammar is incomplete, for example DELETE and UPDATE are only implemented sufficiently to obtain the table name. Now only absence of table name in the statement model is considered for treating it as invalid.


More tests need to be added.