CREATE SCHEMA IF NOT EXISTS :schema; SET search_path to :schema, public; --- DROP TABLE IF EXISTS :schema.tbl_relations; --- CREATE TABLE IF NOT EXISTS :schema.tbl_relations( relation_id BIGSERIAL PRIMARY KEY, relation_from_entity BIGINT NOT NULL, relation_to_entity BIGINT NOT NULL, FOREIGN KEY(relation_to_entity) REFERENCES :schema.tbl_entities(entity_id), FOREIGN KEY(relation_from_entity) REFERENCES :schema.tbl_entities(entity_id)); --- DELETE FROM :schema.tbl_relations; INSERT INTO :schema.tbl_relations (relation_from_entity,relation_to_entity) VALUES (6,1), (6,2), (6,3), (6,4), (6,5), (6,7), (6,8), (6,9), (6,10), (6,11), (6,12) RETURNING *;