[CONJ-816] Table with primary key with DEFAULT function can not be inserted to: Current position is after the last row Created: 2020-08-10 Updated: 2020-09-23 Resolved: 2020-08-24 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | JDBC compatibility |
| Affects Version/s: | 2.4.2, 2.6.2 |
| Fix Version/s: | 2.7.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Tomas Janco | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
platform independent |
||
| Attachments: |
|
| Description |
|
When using JDBC interface to insert data into a table, where the primary key is not AUTO_INCREMENT but a column with DEFAULT UUID(), insertion fails with error: Current position is after the last row. See the atached source file for minimal example. The problem is in https://github.com/mariadb-corporation/mariadb-connector-j/blob/master/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/UpdatableResultSet.java#L1081 The condition is not satisfied for primary keys generated by DEFAULT UUID(), only by AUTO_INCREMENT primary keys. Therefore the primary key is not used for refreshing the row values (lines 1091-1104). Moreover, the call to refreshRawData() on line 1107 fails with exception: {{java.sql.SQLDataException: Current position is before the first row When trying to obtain the primary key value. |
| Comments |
| Comment by Diego Dupin [ 2020-08-20 ] |
|
There is no way to retrieve the generated uuid before 10.5 server version. |