在 postgresql 中使用 row_to_json 时如何从返回的列中删除 f1?

How to remove f1 from returned column when using row_to_json in postgresql?

我正在使用 row_to_json 将列转换为 json。 这是我的查询:

 Select row_to_json(row(func1('cust_1')));

注意 func1 是一个 sql 函数,它接受一个 varchar 和 returns 3 个浮点数

此查询正在 returning:

{"f1":{"col1":0,"col2":0,"col3":0}}

我要的是f1里面的对象,我要查询到return只有这个:

{"col1":0,"col2":0,"col3":0}

我该怎么做? 谢谢

Get JSON object field as text

Select row_to_json(row(func1('cust_1')))->>'f1';