Postgresql函数返回复合值-如何将复合值作为单独的列访问? [英] Postgresql function returns composite - how do I access composite values as separate columns?

查看:91
本文介绍了Postgresql函数返回复合值-如何将复合值作为单独的列访问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Postgresql函数,该函数返回定义为(位置TEXT,id INT)的复合类型。当我运行 SELECT myfunc()时,我的输出是文本类型的单列,格式为:

I have a Postgresql function which returns a composite type defined as (location TEXT, id INT). When I run "SELECT myfunc()", My output is a single column of type text, formatted as:

("locationdata", myid)

这太糟糕了。有没有一种方法可以选择我的复合材料,这样我可以得到2列-TEXT列和INT列?

This is pretty awful. Is there a way to select my composite so that I get 2 columns back - a TEXT column, and an INT column?

推荐答案

使用:

SELECT * 
  FROM myfunc()

您可以了解有关以下功能的更多信息

这篇关于Postgresql函数返回复合值-如何将复合值作为单独的列访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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