Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Looks like method JdbcUpdateCallback.quoteIfNecessary() only quotes column names in these cases:
if (identifier.indexOf(' ') != 1 || identifier.indexOf('') != -1) {
So that if we have a table with a column named “ASmallInt” in Postgres (for example), this results in an error because of its mixed case (Postgres treats unquoted identifiers as lower-case):
Seems like these column names should always be quoted according to the policy of the database (seems like queries are treated this way).
Error code=0, SQL state=42703
Exception details: request: /rest/documents, parameters:
Could not execute insert statement: INSERT INTO "x"."y" (id,first_name,last_name,ASmallInt)) VALUES (?,?,?,?): ERROR: column "asmallint" of relation "y" does not exist
. . .
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2458)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2158)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:291)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:432)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:358)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:171)
at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:138)
at org.apache.metamodel.jdbc.JdbcSimpleUpdateCallback.executePreparedStatement(JdbcSimpleUpdateCallback.java:45)
at org.apache.metamodel.jdbc.JdbcUpdateCallbcutePreparedStatement(JdbcUpdateCallback.java:57)
at org.apache.metamodel.jdbc.JdbcInsertBuilder.execute(JdbcInsertBuilder.java:84)
Attachments
Issue Links
- links to