By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
ERROR: new row for relation "foo" violates check constraint "data_must_be_object" DETAIL: Failing row contains (1, "primitive").
ERROR: new row for relation "foo" violates check constraint "data_must_be_object" DETAIL: Failing row contains (2, ["array"]).
INSERT 0 1
| constraint_catalog | constraint_schema | constraint_name | table_catalog | table_schema | table_name | constraint_type | is_deferrable | initially_deferred | enforced | nulls_distinct |
|---|---|---|---|---|---|---|---|---|---|---|
| postgres | public | data_must_be_object | postgres | public | foo | CHECK | NO | NO | YES | null |
SELECT 1
| table_catalog | table_schema | table_name | column_name | ordinal_position | column_default | is_nullable | data_type | character_maximum_length | character_octet_length | numeric_precision | numeric_precision_radix | numeric_scale | datetime_precision | interval_type | interval_precision | character_set_catalog | character_set_schema | character_set_name | collation_catalog | collation_schema | collation_name | domain_catalog | domain_schema | domain_name | udt_catalog | udt_schema | udt_name | scope_catalog | scope_schema | scope_name | maximum_cardinality | dtd_identifier | is_self_referencing | is_identity | identity_generation | identity_start | identity_increment | identity_maximum | identity_minimum | identity_cycle | is_generated | generation_expression | is_updatable |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| postgres | public | foo | id | 1 | nextval('foo_id_seq'::regclass) | NO | integer | null | null | 32 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | postgres | pg_catalog | int4 | null | null | null | null | 1 | NO | NO | null | null | null | null | null | NO | NEVER | null | YES |
| postgres | public | foo | data | 2 | '{}'::jsonb | NO | jsonb | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | postgres | pg_catalog | jsonb | null | null | null | null | 2 | NO | NO | null | null | null | null | null | NO | NEVER | null | YES |
SELECT 2
| constraint_catalog | constraint_schema | constraint_name | check_clause |
|---|---|---|---|
| postgres | public | data_must_be_object | ((jsonb_typeof(data) = 'object'::text)) |
SELECT 1
| oid | conname | connamespace | contype | condeferrable | condeferred | convalidated | conrelid | contypid | conindid | conparentid | confrelid | confupdtype | confdeltype | confmatchtype | conislocal | coninhcount | connoinherit | conkey | confkey | conpfeqop | conppeqop | conffeqop | confdelsetcols | conexclop | conbin |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16390 | data_must_be_object | 2200 | c | f | f | t | 16385 | 0 | 0 | 0 | 0 | t | 0 | f | {2} | null | null | null | null | null | null | {OPEXPR :opno 98 :opfuncid 67 :opresulttype 16 :opretset false :opcollid 0 :inputcollid 100 :args ({FUNCEXPR :funcid 3210 :funcresulttype 25 :funcretset false :funcvariadic false :funcformat 0 :funccollid 100 :inputcollid 0 :args ({VAR :varno 1 :varattno 2 :vartype 3802 :vartypmod -1 :varcollid 0 :varnullingrels (b) :varlevelsup 0 :varnosyn 1 :varattnosyn 2 :location 133}) :location 120} {CONST :consttype 25 :consttypmod -1 :constcollid 100 :constlen -1 :constbyval false :constisnull false :location 141 :constvalue 10 [ 40 0 0 0 111 98 106 101 99 116 ]}) :location 139} |
SELECT 1