如何显示postgresql表达式类型?

如何显示postgresql表达式类型?,postgresql,Postgresql,我想显示任何表达式类型名称。 类似于python中的“type”函数 要像这样工作: select type(1); 'int' select type(ROW(1, 'abc')); 'row(int, text)' select type(select * from t1); 'setof t1' postgresql中有类似的东西吗?它被称为,尽管它不是您想要的 select pg_typeof(1), ROW(1, 'abc'); 返回 pg|U类型|行 -----+---- 整

我想显示任何表达式类型名称。 类似于python中的“type”函数

要像这样工作:

select type(1);
'int'

select type(ROW(1, 'abc'));
'row(int, text)'

select type(select * from t1);
'setof t1'
postgresql中有类似的东西吗?

它被称为,尽管它不是您想要的

select pg_typeof(1), ROW(1, 'abc');
返回

pg|U类型|行 -----+---- 整数| 1,abc 但是,您不能使用pg_typeofselect*fromt1,即使限制为1,因为函数需要一个表达式作为输入,而不是多列。不过,您可以执行如下操作:pg_类型从t1中选择一些_列