I don't have much insight. One thought though: Are you doing these inserts/updates with the same DataContext that you used for creating the table? Or was the table pre-existing? I'm asking because I guess it could be related to the CREATE TABLE which defined the column names too. And if MetaModel is responsible for creating the columns, but maybe not quoting their names at that time, then I could see a discrepancy occuring when you try to insert. So is that a possibility?
Den fre. 2. nov. 2018 kl. 03.05 skrev Dennis Krøger <[email protected]>: > According to > > https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS > , > columns are case-insensitive if created without quotes, but case-sensitive > if created with quotes. > > I'm not entirely sure how we're handling that. It's not really a difference > the table creation classes handles AFAIK, and I suspect we don't really > expect case-sensitivity in PostgreSQL tables, but it's been quite a while > for me, so I might remember wrong. > > Kasper, do you have some more insight? > > BR, > Dennis > > On Fri, Nov 2, 2018 at 10:19 AM Vijay Kumar Jalagari > <[email protected]> wrote: > > > Hi, > > > > I am using Apache metamodel with data source PostgreSQL 11 and while > > executing insert(InsertInto) or update statement query is failing if > table > > column name contains upper characters. > > According to logs statement is generating properly but it seems > postgresql > > is converting column names to lowercases. > > > > Is it know issue? Is there any workaround for resolving it? > > > > Logs > > org.apache.metamodel.jdbc.JdbcUtils Could not execute insert statement: > > INSERT INTO "public"."employee" > > (id,name,age,dob,mobileNo,zip,profilePicture,vendor) VALUES > > (?,?,?,?,?,?,?,?): ERROR: column "mobileno" of relation "employee" does > not > > exist > > Position: 50, Error code=0, SQL state=42703 > > org.postgresql.util.PSQLException: ERROR: column "mobileno" of relation > > "employee" does not exist > > Position: 50 > > at > > > org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440) > > [org.postgresql.jdbc42:42.2.5] > > at > > > org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183) > > [org.postgresql.jdbc42:42.2.5] > > at > > > org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308) > > [org.postgresql.jdbc42:42.2.5] > > at > > org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441) > > [org.postgresql.jdbc42:42.2.5] > > at > > org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365) > > [org.postgresql.jdbc42:42.2.5] > > at > > > org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:143) > > [org.postgresql.jdbc42:42.2.5] > > at > > > org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:120) > > [org.postgresql.jdbc42:42.2.5] > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native > > Method) > > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown > > Source) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown > > Source) > > at java.lang.reflect.Method.invoke(Unknown Source) > > at > > > org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:235) > > [org.apache.sling.datasource:1.0.2] > > at com.sun.proxy.$Proxy195.executeUpdate(Unknown Source) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native > > Method) > > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown > > Source) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown > > Source) > > at java.lang.reflect.Method.invoke(Unknown Source) > > at > > > org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor$StatementProxy.invoke(StatementDecoratorInterceptor.java:261) > > [org.apache.sling.datasource:1.0.2] > > at com.sun.proxy.$Proxy195.executeUpdate(Unknown Source) > > at > > > org.apache.metamodel.jdbc.JdbcSimpleUpdateCallback.executePreparedStatement(JdbcSimpleUpdateCallback.java:45) > > [aem-dermis-core:3.0.33.SNAPSHOT] > > at > > > org.apache.metamodel.jdbc.JdbcUpdateCallback.executePreparedStatement(JdbcUpdateCallback.java:71) > > [aem-dermis-core:3.0.33.SNAPSHOT] > > at > > > org.apache.metamodel.jdbc.JdbcUpdateCallback.executeInsert(JdbcUpdateCallback.java:272) > > [aem-dermis-core:3.0.33.SNAPSHOT] > > at > > > org.apache.metamodel.jdbc.JdbcInsertBuilder.execute(JdbcInsertBuilder.java:85) > > [aem-dermis-core:3.0.33.SNAPSHOT] > > > > > > Regards, > > Vijay Kumar J > > > -- > Med venlig hilsen, > Dennis Du Krøger >
