加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何更改PostgreSQL数据库表中列的位置?

发布时间:2020-12-13 16:47:24 所属栏目:百科 来源:网络整理
导读:我试过以下,但我不成功: ALTER TABLE person ALTER COLUMN dob POSITION 37; “ Alter column position”在PostgreSQL Wiki中说: PostgreSQL currently defines column order based on the attnum column of the pg_attribute table. The only way to cha
我试过以下,但我不成功:
ALTER TABLE person ALTER COLUMN dob POSITION 37;
“ Alter column position”在PostgreSQL Wiki中说:

PostgreSQL currently defines column
order based on the attnum column of
the pg_attribute table. The only way
to change column order is either by
recreating the table,or by adding
columns and rotating data until you
reach the desired layout.

这很脆弱,但在标准SQL中,没有解决方案来重新定位列。支持更改列的顺序位置的数据库品牌定义了SQL语法的扩展。

另一个想法发生在我身上:你可以定义一个VIEW,指定列的顺序你喜欢它,而不改变基表中的列的物理位置。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读