我使用Intellij Idea Ultimate 2016.3版本。我尝试使用Intellij Idea的默认“数据库”插件连接到Postgres数据库。但是,当我尝试与数据库同步时,我在事件日志中看到:
错误:列引用“oid”的位置不明确:1205。
我试着检查了日志,这就是我发现的。

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

然后我看到下面有一个查询正在执行。
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')
)

最佳答案

在Intellij Idea论坛上进行了彻底搜索之后,我执行了以下操作:
创建连接时,在“选项”选项卡下,提供对象筛选器。例如:table:ABC_.*(假设所有表都以ABC_u前缀开头)
选中“使用JDBC元数据进行内省”
从“加载源”选择框中选择“除系统架构外”
经过上述步骤,才得以解决问题。以下链接帮助了我:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/207089995--Basic-attribute-type-should-not-be-Object-
https://youtrack.jetbrains.com/issue/IDEA-150816
https://youtrack.jetbrains.com/issue/DBE-2771
希望这对某人有帮助

关于postgresql - Intellij Idea Ultimate Postgres/EDB数据库插件“oid”不明确,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41061170/

10-16 22:44
查看更多