IT/Postgresql DBMS
Postgresql json_typeof/jsonb_typeof 설명 : 포스트그레스큐엘 함수
WorldSeeker
2021. 5. 1. 14:36
1. 함수의 목적
Postgresql json_typeof/jsonb_typeof 함수는 json에 관련된 함수로서, jsonb로 입력된 인수 최상위 레벨의 데이터 타입명칭을 text로 반환한다. 반환값은 object, array, string, number, boolean와 null등이 될 수 있다. (null은 SQL의 NULL과 다름)
2. 샘플을 통한 개념 퀵뷰
SELECT json_typeof('-123.4')
json_typeof
------------
number
3. 사용방법
json_typeof ( json )
jsonb_typeof ( jsonb )
4. 함수 PARAMETER 설명
[json/jsonb]
체크할 source json/jsonb를 입력한다.
5. 다양한 샘플 표현
1) 최상위 레벨이 null일 경우 null을 반환한다.
SELECT json_typeof('null'::json);
2) 'null'과 NULL은 다름
SELECT json_typeof(NULL::json) IS NULL;
SELECT json_typeof('null'::json) IS NULL;
▶▶ Posgresql 내장함수 모음 : atotw.tistory.com/category/IT/Postgresql%20DBMS