You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metamodel.apache.org by "Dana Borger (JIRA)" <ji...@apache.org> on 2017/07/21 14:32:00 UTC
[jira] [Created] (METAMODEL-1143) Column names not quoted on insert
Dana Borger created METAMODEL-1143:
--------------------------------------
Summary: Column names not quoted on insert
Key: METAMODEL-1143
URL: https://issues.apache.org/jira/browse/METAMODEL-1143
Project: Apache MetaModel
Issue Type: Bug
Reporter: Dana Borger
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)
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)