Table Structure:
Old Table Structure:
New Table Structure:
Query:
INSERT INTO hotel (id, name, hotel_type, active, parent_hotel_id)
SELECT id, name, hotel_type, active, parent_hotel_id
FROM dblink('demopostgres', 'SELECT id, name, hotel_type, active, parent_hotel_id FROM hotel')
AS data(id bigint, name character varying, hotel_type character varying, active boolean, parent_hotel_id bigint);
Following error occurs:
ERROR: null value in column "created_by" violates not-null constraint DETAIL: Failing row contains (1, Test Hotel, THREE_STAR, t, null, null, null, null, null, null). SQL state: 23502
I tried to insert other required columns
Note: created_by as Jsonb
created_by = '{
"id": 1,
"email": "tes@localhost",
"login": "test",
"lastName": "Test",
"firstName": "Test",
"displayName": "test"
}'
created_date = '2020-02-22 16:09:08.346'
How can I pass default values for created_by and created_date column while moving data from the old table?

