如何在psql中将类型aclitem强制转换为text或varchar?

如何在psql中将类型aclitem强制转换为text或varchar?,text,casting,enumeration,varchar,psql,Text,Casting,Enumeration,Varchar,Psql,我试图对aclitem执行like/~操作,但遇到问题。我无法将此类型强制转换为text或varchar类型,因此无法使用like或~运算符。我有同样的问题与cstring类型。我猜这是不知怎么列举出来的,但我似乎找不到钥匙。有什么想法吗 这是我要运行的查询类型: select case when relacl[1] ~ '%searchstring%' then 1 else 0 end as temp1, case when relacl[1] like '%searchstri

我试图对aclitem执行like/~操作,但遇到问题。我无法将此类型强制转换为text或varchar类型,因此无法使用like或~运算符。我有同样的问题与cstring类型。我猜这是不知怎么列举出来的,但我似乎找不到钥匙。有什么想法吗

这是我要运行的查询类型:

select
   case when relacl[1] ~ '%searchstring%' then 1 else 0 end as temp1,
   case when relacl[1] like '%searchstring%' then 1 else 0 end as temp2,
   case when aclitemout(relacl[1]) ~ '%searchstring%' then 1 else 0 end as temp3,
   case when aclitemout(relacl[1]) like '%searchstring%' then 1 else 0 end as temp4,
   relacl[1]::text as temp5,
   relacl[1]::varchar as temp6,
   aclitemout(relacl[1])::text as temp7,
   aclitemout(relacl[1])::varchar as temp8
from
   pg_class c
;

relacl是一种数组类型,因此可以使用array_to_string(array(relacl))将其转换为可搜索字符串