psql -U is_derayo -c "SELECT code, name, continent FROM country;"; psql -U is_derayo postgres -c "CREATE DATABASE IF NOT EXISTS "Hola" WITH OWNER = is_derayo ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' CONNECTION LIMIT = -1;"; https://www.tutorialspoint.com/postgresql/postgresql_create_database.htm createdb -h localhost -p 5432 -U postgres testdb -- View: "Accounting".v_chartofaccounts -- DROP VIEW "Accounting".v_chartofaccounts; CREATE OR REPLACE VIEW "Accounting".v_chartofaccounts AS SELECT chartofaccounts.cia, (((((substr(chartofaccounts.account::text, 1, 1) || '.'::text) || substr(chartofaccounts.account::text, 2, 2)) || '.'::text) || substr(chartofaccounts.account::text, 4, 3)) || '.'::text) || substr(chartofaccounts.account::text, 7, 3) AS account, chartofaccounts.description, chartofaccounts.level, chartofaccounts.able, chartofaccounts.balanceprofitloss AS bpl FROM "Accounting".chartofaccounts ORDER BY chartofaccounts.cia, ((((((substr(chartofaccounts.account::text, 1, 1) || '.'::text) || substr(chartofaccounts.account::text, 2, 2)) || '.'::text) || substr(chartofaccounts.account::text, 4, 3)) || '.'::text) || substr(chartofaccounts.account::text, 7, 3)); ALTER TABLE "Accounting".v_chartofaccounts OWNER TO postgres; -- Rule: "_RETURN" ON "Accounting".v_chartofaccounts -- DROP RULE "_RETURN" ON "Accounting".v_chartofaccounts; CREATE OR REPLACE RULE "_RETURN" AS ON SELECT TO "Accounting".v_chartofaccounts DO INSTEAD SELECT chartofaccounts.cia, (((((substr(chartofaccounts.account::text, 1, 1) || '.'::text) || substr(chartofaccounts.account::text, 2, 2)) || '.'::text) || substr(chartofaccounts.account::text, 4, 3)) || '.'::text) || substr(chartofaccounts.account::text, 7, 3) AS account, chartofaccounts.description, chartofaccounts.level, chartofaccounts.able, chartofaccounts.balanceprofitloss AS bpl FROM "Accounting".chartofaccounts ORDER BY chartofaccounts.cia, ((((((substr(chartofaccounts.account::text, 1, 1) || '.'::text) || substr(chartofaccounts.account::text, 2, 2)) || '.'::text) || substr(chartofaccounts.account::text, 4, 3)) || '.'::text) || substr(chartofaccounts.account::text, 7, 3)); -- Schema: GeneralAdministration -- DROP SCHEMA "GeneralAdministration"; CREATE SCHEMA "GeneralAdministration" AUTHORIZATION is_derayo; GRANT ALL ON SCHEMA "GeneralAdministration" TO is_derayo; GRANT ALL ON SCHEMA "GeneralAdministration" TO public;