0

私は電話をかけjsonb_each_textていますが、期待どおりに動作しており、これが返されます:

select jsonb_each_text('{"text": "this is text", "text2": "this is text2", "f_id": "21"}') as line;
          line           
-------------------------
 (f_id,21)
 (text,"this is text")
 (text2,"this is text2")
(3 rows)

これを行うことで、キーだけを簡単に返すことができることを知っています。

select jsonb_object_keys('{"text": "this is text", "text2": "this is text2", "f_id": "21"}') as line;
 line  
-------
 f_id
 text
 text2
(3 rows)

値のみを返す方法はありますか?

たとえば、これを出力として使用したいと思います。

          line           
-------------------------
21
"this is text"
"this is text2"

値は一意である必要はありません。

jsonb_object_keys値のみに相当するものを見つけることができませんでした。

4

1 に答える 1

1

適切なセットを返す関数として使用します。

select t.value
from jsonb_each_text('{"text": "this is text", "text2": "this is text2", "f_id": "21"}') as t(key, value);
于 2021-01-06T16:13:56.267 に答える