IT/Postgresql DBMS
Postgresql json_populate_record/jsonb_populate_record 설명 : 포스트그레스큐엘 함수
WorldSeeker
2021. 4. 27. 14:44
1. 함수의 목적
Postgresql json_extract_path/jsonb_extract_path 함수는 json에 관련된 함수로서, base 인수에 지정된 형식의 row로 반환한다.
2. 샘플을 통한 개념 퀵뷰
create type subrowtype as (d int, e text);
create type myrowtype as (a int, b text[], c subrowtype);
select * from json_populate_record(null::myrowtype, '{"a": 1, "b": ["2", "a b"], "c": {"d": 4, "e": "a b c"}, "x": "foo"}');
3. 사용방법
json_populate_record ( base anyelement, from_json json )
jsonb_populate_record ( base anyelement, from_json jsonb )
4. 함수 PARAMETER 설명
[base anyelement]
추출될 형식을 지정할 composite type 이름을 입력한다.
[from_json json]
정렬할 형식을 지정한 type 명을 입력한다.
5. 다양한 샘플 표현
▶▶ Posgresql 내장함수 모음 : atotw.tistory.com/category/IT/Postgresql%20DBMS