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
  • 11
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值