I have a script called populate.sql which contains create tables.
CREATE TABLE "EXAMPLE" (
.................
..............
);
CREATE TABLE "BlaBla" (
..........
........
);
CREATE TABLE ...
This script creates more than 20 tables. I want to run this populate.sql on top of different schemas. Let's say I want to run this script on schema1, schema2 and schema3.
Then I can write;
CREATE SCHEMA IF NOT EXISTS "schema1";
SET SCHEMA 'schema1';
on populate.sql and create those tables on one schema.
how can I create those tables on all schema within one psql command?
As far as I feel I have to do FOR LOOP on psql and create schema first and create tables on top of that scheme.