19
PostgreSQL 9.3.4에서 "person"이라는 JSON 유형 열이 있고 그 안에 저장된 데이터의 형식은 {dogs: [{breed: <>, name: <>}, {breed: <>, name: <>}]}
입니다. 왜PostgreSQL 중첩 JSON 쿼리
이
db=> select person->'dogs'->>0->'breed' from people where id = 77;
ERROR: operator does not exist: text -> unknown
LINE 1: select person->'dogs'->>0->'bree...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
작품
select (person->'dogs'->>0)::json->'breed' from es_config_app_solutiondraft where id = 77;
?column?
-----------
"westie"
(1 row)
을 작동하지 않습니다 : 나는 여기에 내가 실행 한 두 쿼리는 인덱스 0에서 강아지의 품종을 검색 할 타입 캐스팅이 필요합니까? 비효율적이지 않습니까? 잘못되었거나 JSON 지원에 필요합니까?