Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6Kg9RWSTJzyz6KP9X
37 lines
1.7 KiB
Plaintext
37 lines
1.7 KiB
Plaintext
# PostgreSQL 18.6 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit
|
|
# Hibernate 7.4.14.Final
|
|
|
|
== CREATE TABLE as Hibernate emits it (JPA script generation, nothing executed)
|
|
create table t_coldef_json (id bigint generated by default as identity, doc json, primary key (id));
|
|
create table t_coldef_jsonb (id bigint generated by default as identity, doc jsonb, primary key (id));
|
|
create table t_default (id bigint generated by default as identity, doc jsonb, primary key (id));
|
|
create table t_jdbctype_json (id bigint generated by default as identity, doc jsonb, primary key (id));
|
|
create table t_jdbctype_jsonb (id bigint generated by default as identity, doc jsonb, primary key (id));
|
|
create table t_list (id bigint generated by default as identity, items jsonb, primary key (id));
|
|
|
|
== information_schema after hbm2ddl=create (column, data_type)
|
|
t_coldef_json.doc | json
|
|
t_coldef_jsonb.doc | jsonb
|
|
t_default.doc | jsonb
|
|
t_jdbctype_json.doc | jsonb
|
|
t_jdbctype_jsonb.doc | jsonb
|
|
t_list.items | jsonb
|
|
|
|
== what is stored: pg_typeof(doc) and the text PostgreSQL returns
|
|
t_default | jsonb | {"a": 1, "b": ["x", "y"]}
|
|
t_coldef_json | json | {"a": 1, "b": ["x", "y"]}
|
|
t_coldef_jsonb | jsonb | {"a": 1, "b": ["x", "y"]}
|
|
t_jdbctype_json | jsonb | {"a": 1, "b": ["x", "y"]}
|
|
t_jdbctype_jsonb | jsonb | {"a": 1, "b": ["x", "y"]}
|
|
t_list | jsonb | ["p", "q"]
|
|
|
|
== reading each variant back through Hibernate
|
|
t_default -> {a=1, b=[x, y]}
|
|
t_coldef_json -> {a=1, b=[x, y]}
|
|
t_jdbctype_json-> {a=1, b=[x, y]}
|
|
|
|
== json vs jsonb is observable: key order, duplicate keys and whitespace
|
|
json | jsonb: {"z": 1, "a": 2, "a": 3} | {"a": 3, "z": 1}
|
|
json = json: ERROR: operator does not exist: json = json
|
|
jsonb = jsonb: t
|