如何解决“错误:列c.relhasoids不存在”在Postgres? [英] How to fix "ERROR: column c.relhasoids does not exist" in Postgres?

查看:3884
本文介绍了如何解决“错误:列c.relhasoids不存在”在Postgres?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Postgresql中创建 CREATE TABLE 命令。
创建表后,如果我在 TABLE 表名中打孔,它将起作用。

I’m trying to CREATE TABLE command in Postgresql. After creating a table, if I punch in TABLE table name, it works.

但是我输入了 \d 表名,下面仍然出现错误。

But I punch in \d table name, I keep getting an error below.

错误:列c.relhasoids不存在
第1行:...索具,c.relrowsecurity,c.relforcerowsecurity,c.relhasoi ...

我尝试 DROP DATABASE 表名重新创建数据库并再次重新创建表几次。

I attempted DROP DATABASE table name recreated a database and recreated a table again several times. But it didn't work.

任何建议,我们将不胜感激!谢谢。

Any suggestions would be appreciated! Thank you.

推荐答案

如果我使用的是Postgres v.12和较旧的客户端(v。 11或更早版本):

I am able to reproduce your error if I am using Postgres v.12 and an older client (v.11 or earlier):

[root@def /]# psql -h 172.17.0.3
psql (11.5, server 12.0)
WARNING: psql major version 11, server major version 12.
         Some psql features might not work.
Type "help" for help.

postgres=# create table mytable (id int, name text);
CREATE TABLE
postgres=# table mytable;
 id | name 
----+------
(0 rows)

postgres=# \d mytable;
ERROR:  column c.relhasoids does not exist
LINE 1: ...riggers, c.relrowsecurity, c.relforcerowsecurity, c.relhasoi...
                                                             ^
postgres=# 

这是因为在第12版中,表OID不再被视为特殊列,因此 relhasoids 列不再是必需的。请确保您使用的是v。12 psql 二进制文件,这样就不会遇到此错误。

This is because in v. 12, table OIDs are no longer treated as special columns, and hence the relhasoids column is no longer necessary. Please make sure you're using a v. 12 psql binary so you don't encounter this error.

您不一定要使用 psql ,所以这里更通用的答案是确保您使用的是兼容的客户端。

You may not necessarily be using psql, so the more general answer here is to make sure you’re using a compatible client.

这篇关于如何解决“错误:列c.relhasoids不存在”在Postgres?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆