문제

The PostgreSQL documentation for JSON functions lists both both -> and ->>.

However, it's not clear to me what the difference is between them.

Can anyone provide an explanation with more examples?

도움이 되었습니까?

해결책

The first returns json and the second text:

select
    '[1,2,3]'::json->2 as "->",
    pg_typeof('[1,2,3]'::json->2) as "-> type",
    '[1,2,3]'::json->>2 as "-->",
    pg_typeof('[1,2,3]'::json->>2) as "--> type"
;
 -> | -> type | --> | --> type 
----+---------+-----+----------
 3  | json    | 3   | text
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top