IT/Postgresql DBMS
Postgresql json_extract_path_text/jsonb_extract_path_text 설명 : 포스트그레스큐엘 함수
WorldSeeker
2021. 4. 27. 14:29
1. 함수의 목적
Postgresql json_extract_path_text/jsonb_extract_path_text 함수는 json에 관련된 함수로서, 인수로 지정된 경로의 JSON 하위 개체를 추출하여 text로 반환한다. (기능적으로 #>> 연산자와 동일)
2. 샘플을 통한 개념 퀵뷰
select json_extract_path_text('{"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}', 'f4', 'f6') ;
json_extract_path_text
-------------------
foo
3. 사용방법
json_extract_path_text ( from_json json, VARIADIC path_elems text[] )
jsonb_extract_path_text ( from_json json, VARIADIC path_elems text[] )
4. 함수 PARAMETER 설명
[from_json json]
추출 대상이 되는 json/jsonb를 입력한다.
[VARIADIC path_elems text[] ]
추출하고자 하는 경로를 text배열로 입력한다.
5. 다양한 샘플 표현
▶▶ Posgresql 내장함수 모음 : atotw.tistory.com/category/IT/Postgresql%20DBMS