Redshift:添加列(如果不存在) [英] Redshift: add column if not exists

查看:185
本文介绍了Redshift:添加列(如果不存在)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下在Postgres 9.6中有效,但在Redshift中不起作用:

The following works in Postgres 9.6 but not in Redshift:

ALTER TABLE stats
    ADD COLUMN IF NOT EXISTS panel_exit timestamp;

在Redshift中可以实现相同的功能吗?

Can the same functionality be achieved in Redshift?

推荐答案

没有与ADD COLUMN IF NOT EXISTS等效的Amazon Redshift命令.

There is no Amazon Redshift command equivalent to ADD COLUMN IF NOT EXISTS.

请参阅: ALTER TABLE文档

要复制此功能,您的应用程序首先需要查询表元数据,然后决定是否发出ADD COLUMN命令.

To replicate this functionality, your application would first need to query the table metadata and then make the decision whether to issue the ADD COLUMN command.

这篇关于Redshift:添加列(如果不存在)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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