[ 
https://issues.apache.org/jira/browse/HIVE-24826?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Fabien Carrion updated HIVE-24826:
----------------------------------
    Attachment: check_schema.patch

> PSQLException when trying to create an external table on postgresql and not 
> the default schema
> ----------------------------------------------------------------------------------------------
>
>                 Key: HIVE-24826
>                 URL: https://issues.apache.org/jira/browse/HIVE-24826
>             Project: Hive
>          Issue Type: Bug
>          Components: JDBC storage handler
>            Reporter: Fabien Carrion
>            Priority: Major
>         Attachments: check_schema.patch
>
>
> I was receiving a psql exception indicating the table doesnt exist while 
> creating an external table which points on a postgresql table which is not in 
> the default schema like this:
> {color:#172b4d}{{CREATE EXTERNAL TABLE test (test_id int, test_id2 int, name 
> string) STORED BY 'org.apache.hive.storage.jdbc.JdbcStorageHandler' 
> TBLPROPERTIES ("hive.sql.database.type" = "POSTGRES", "hive.sql.jdbc.driver" 
> = "org.postgresql.Driver", "hive.sql.jdbc.url" = 
> "jdbc:postgresql://192.168.0.1:5432/test", "hive.sql.dbcp.username" = "test", 
> "hive.sql.dbcp.password" = "*****", "hive.sql.schema" = "hive_imports", 
> "hive.sql.table" = "test", "external.table.purge" = "false");}}{color}
>  
>  
> {color:#172b4d}The exact Exception is{color}
> {color:#172b4d}{{org.postgresql.util.PSQLException: ERROR: relation "test" 
> does not exist
>   Position: 15
>       at 
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2284)
>  ~[postgresql-9.4.1208.jre7.jar:9.4.1208.jre7]
>       at 
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2003)
>  ~[postgresql-9.4.1208.jre7.jar:9.4.1208.jre7]
>       at 
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:200) 
> ~[postgresql-9.4.1208.jre7.jar:9.4.1208.jre7]
>       at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424) 
> ~[postgresql-9.4.1208.jre7.jar:9.4.1208.jre7]
>       at 
> org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:161)
>  ~[postgresql-9.4.1208.jre7.jar:9.4.1208.jre7]
>       at 
> org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:114)
>  ~[postgresql-9.4.1208.jre7.jar:9.4.1208.jre7]
>       at 
> org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122)
>  ~[commons-dbcp2-2.5.0.jar:2.5.0]
>       at 
> org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122)
>  ~[commons-dbcp2-2.5.0.jar:2.5.0]
>       at 
> org.apache.hive.storage.jdbc.dao.GenericJdbcDatabaseAccessor.getColumnNames(GenericJdbcDatabaseAccessor.java:81)
>  ~[hive-jdbc-handler-3.1.0.3.1.4.0-315.jar:4.0.0-SNAPSHOT]
>       at 
> org.apache.hive.storage.jdbc.JdbcSerDe.initialize(JdbcSerDe.java:102) 
> ~[hive-jdbc-handler-3.1.0.3.1.4.0-315.jar:4.0.0-SNAPSHOT]
>       at 
> org.apache.hadoop.hive.serde2.AbstractSerDe.initialize(AbstractSerDe.java:54) 
> ~[hive-exec-3.1.0.3.1.4.0-315.jar:3.1.0.3.1.4.0-315]
>       at 
> org.apache.hadoop.hive.serde2.SerDeUtils.initializeSerDe(SerDeUtils.java:540) 
> ~[hive-exec-3.1.0.3.1.4.0-315.jar:3.1.0.3.1.4.0-315]
>       at 
> org.apache.hadoop.hive.metastore.HiveMetaStoreUtils.getDeserializer(HiveMetaStoreUtils.java:90)
>  ~[hive-exec-3.1.0.3.1.4.0-315.jar:3.1.0.3.1.4.0-315]}}{color}
>  
> {color:#172b4d}In the patch I just check if there is a schema indicated in 
> the definition of the table. In the case there is, it used it to make the 
> metadata discovery queries.{{}}{color}
>  
>  



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

Reply via email to