PostgreSQL – How to Define a JSONB Column with Default Value

jsonpostgresql

I am unable to find in the documentation how to create
a JSONB column in PostgreSQL that has a DEFAULT value of
an empty json document.

How the above can be stated in the CREATE TABLE definition ?

Best Answer

That's the same as with any other default value:

create table amsterdam
(
   id       integer primary key, 
   payload  jsonb not null default '{}'::jsonb
);