You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metamodel.apache.org by "William Edmisten (Jira)" <ji...@apache.org> on 2021/01/05 20:08:00 UTC

[jira] [Commented] (METAMODEL-1230) JdbcDataContext.getDefaultSchema() does not work for postgres > 9

    [ https://issues.apache.org/jira/browse/METAMODEL-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17259182#comment-17259182 ] 

William Edmisten commented on METAMODEL-1230:
---------------------------------------------

I believe this was a duplicate or related to: https://issues.apache.org/jira/browse/METAMODEL-1224

 

Solution was to upgrade the postgres library version in our pom.xml, so this wasn't a metamodel bug. Marking as resolved.

> JdbcDataContext.getDefaultSchema() does not work for postgres > 9
> -----------------------------------------------------------------
>
>                 Key: METAMODEL-1230
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-1230
>             Project: Apache MetaModel
>          Issue Type: Bug
>    Affects Versions: 5.3.2
>            Reporter: William Edmisten
>            Priority: Major
>
> When connected to a postgres version > 9, getDefaultSchema() returns a schema with an empty name. It also does NOT throw an exception, which it probably should in this scenario. This results in an error when trying to execute a query on this database:
>  
> {code:java}
> Caused by: org.apache.metamodel.MetaModelException: Could not execute create table statement: CREATE TABLE .TableName (id VARCHAR, name VARCHAR, PRIMARY KEY(id)): ERROR: syntax error at or near "."
>   Position: 14
> 	at org.apache.metamodel.jdbc.JdbcUtils.wrapException(JdbcUtils.java:70)
> 	at org.apache.metamodel.jdbc.JdbcCreateTableBuilder.execute(JdbcCreateTableBuilder.java:62)
> 	at org.apache.metamodel.create.CreateTable.run(CreateTable.java:65)
> 	at org.apache.metamodel.create.CreateTableColumnBuilder.run(CreateTableColumnBuilder.java:39)
> 	at org.apache.metamodel.jdbc.JdbcDataContext.executeUpdate(JdbcDataContext.java:837)
> {code}
> Tested on postgres 10, 11, and 12. Via postgres docker image ([https://hub.docker.com/_/postgres)|https://hub.docker.com/_/postgres]
> Also see: [https://metamodel.apache.org/apidocs/4.5.2/org/apache/metamodel/AbstractDataContext.html#getDefaultSchema--]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)