【发布时间】:2016-05-04 16:32:16
【问题描述】:
This question 告诉如何检查 Postgres 中是否存在类型。我试着这样使用它:
select
case when exists (select 1 from pg_type where typname = 'my_type')
then unnest(enum_range(NULL::my_type))
else null
end
不幸的是,Postgres 并不懒惰,所以当类型不存在时,这会给我一个类型错误。我该怎么做?
【问题讨论】:
标签: postgresql