Intellij Idea Ultimate Postgres/EDB database plugin "oid" is ambigous

时间:2016-12-09 13:03:33

标签: postgresql intellij-idea

I use Intellij Idea Ultimate 2016.3 version. I try to connect to Postgres DB using the Intellij Idea's default "Database" plugin. However when i try to sync with the DB, I see this in the event log:

ERROR: column reference "oid" is ambiguous Position: 1205.

I tried checking the logs and this is what I found.

Caused by: org.jetbrains.dekaf.exceptions.StrippedSQLException: org.postgresql.util.PSQLException: ERROR: column reference "oid" is ambiguous   Position: 1205
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:413)
at org.jetbrains.dekaf.jdbc.JdbcIntermediateSeance.execute(JdbcIntermediateSeance.java:100)
at com.intellij.database.remote.jdba.impl.RemoteSeanceImpl.execute(RemoteSeanceImpl.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
... 3 more

Then I see there is a query like below getting executed.

The SQL statement:

select max(last_tx) as state_number from (select max(xmin::varchar::bigint) as last_tx
    from pg_catalog.pg_type
    where typnamespace = oid(?)  
union all 
select max(xmin::varchar::bigint) as last_tx 
from pg_catalog.pg_class where relnamespace = oid(?) 
union all 
select max(xmin::varchar::bigint) as last_tx 
from pg_catalog.pg_proc where pronamespace = oid(?) 
union all 
select max(xmin::varchar::bigint) as last_tx 
from pg_catalog.pg_operator where oprnamespace = oid(?) 
union all   
select max(A.xmin::varchar::bigint) as last_tx 
from pg_catalog.pg_attribute A 
join pg_catalog.pg_class K on K.oid = A.attrelid 
where K.relnamespace = oid(?) 
union all 
select max(xmin::varchar::bigint) as last_tx 
from pg_catalog.pg_constraint 
where connamespace = oid(?) 
union all 
select max(IX.xmin::varchar::bigint) as last_tx 
from pg_catalog.pg_index IX,  pg_catalog.pg_class IC 
where IC.oid = IX.indrelid and IC.relnamespace = oid(?) 
union all 
select max(RU.xmin::varchar::bigint) as last_tx 
from pg_catalog.pg_rewrite RU, pg_catalog.pg_class RC 
where RC.oid = RU.ev_class and RC.relnamespace = oid(?)  
union all 
select max(TG.xmin::varchar::bigint) as last_tx 
from pg_catalog.pg_trigger TG,  pg_catalog.pg_class TC 
where TC.oid = TG.tgrelid and TC.relnamespace = oid(?) 
union all 
select max(DE.xmin::varchar::bigint) as last_tx  
from pg_catalog.pg_description DE, pg_catalog.pg_class DC 
where DC.oid = DE.objoid and DC.relnamespace = oid(?) and DC.relkind in ('r', 'm', 'v')
)

1 个答案:

答案 0 :(得分:2)

在对Intellij Idea论坛进行彻底搜索后,我做了以下事情:

  1. 创建连接时,在"选项"选项卡,提供对象过滤器。例如:表格:ABC _。*(假设所有表格都以ABC_前缀开头)
  2. 使用JDBC元数据"
  3. 检查"内省
  4. 选择#34;除了系统架构"从选择框"加载来源"
  5. 经过上述步骤,才得以解决问题。以下链接帮助了我:

    1. https://intellij-support.jetbrains.com/hc/en-us/community/posts/207089995--Basic-attribute-type-should-not-be-Object-
    2. https://youtrack.jetbrains.com/issue/IDEA-150816
    3. https://youtrack.jetbrains.com/issue/DBE-2771
    4. 希望这有助于某人