Intelij 中的 Database Tools可以連接但是無法顯示SCHEMA, TABLES

問題描述:在使用Postgres 數據庫的過程中,數據庫顯示連接成功,使用第三方的數據庫連接也正常,但是在Intelij自帶的DataGrip工具中無法正常的顯示Schema 和Tables信息。

使用軟件:

  • Intelij 版本爲 2019.3
  • Docker 版本的 Postgres 12

問題描述

每次點擊更新數據庫按鈕,無法刷新出數據庫的Tables。

image.png

並且Log控制檯爆出如下錯誤:

12:53	Connected

12:53	select T.relkind as table_kind,
			T.relname as table_name,
			T.oid as table_id,
			T.xmin as table_state_number,
			T.relhasoids as table_with_oids,
			T.relnamespace as tablespace_id,
			T.reloptions as options,
			(select pg_catalog.array_agg(inhparent)::varchar from (select inhparent::bigint from pg_catalog.pg_inherits where T.oid = inhrelid order by inhseqno) as bts) as ancestors,
			(select pg_catalog.array_agg(inhrelid)::varchar from (select inhrelid::bigint from pg_catalog.pg_inherits where T.oid = inhparent order by inhrelid) as its) as successors,
			T.relispartition /* false */ as is_partition,
			pg_catalog.pg_get_partkeydef(T.oid) /* null */ as partition_key,
			pg_catalog.pg_get_expr(T.relpartbound, T.oid) /* null */ as partition_expression,
			pg_catalog.pg_get_userbyid(T.relowner) as "owner"
			from pg_catalog.pg_class T
			where relnamespace = ?::oid
			and relkind in ('r', 'm', 'v', 'f', 'p')
			and pg_catalog.age(T.xmin) <= pg... (show balloon)

12:53	yinxiang@localhost
			[42703] org.postgresql.util.PSQLException: ERROR: column t.relhasoids does not exist
			Position: 135.
			Error encountered  ... more

解決方案

將數據庫工具中的 Option --> Introspect using JDBC metadata 按鈕勾上,問題得以解決:

image.png

成功顯示如下:

image.png

參考文獻:

  1. PostgreSQL showing tables problem – IDEs Support (IntelliJ Platform) | JetBrains
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章