'How to execute *.sql file using psql

I have created an index.sql file which contains index creating script for 95 table

for example

DROP INDEX IF EXISTS gtab03_vrctrlid_idx cascade;
CREATE UNIQUE INDEX gtab03_vrctrlid_idx ON gtab03 USING btree (vrctrlid);

I have consolidated all table's index creating script to a file called index.sql I need to run the entire script at a time, is it possible to execute the index.sql file using psql



Solution 1:[1]

Is this what you mean?

\i e:/myFolder/index.sql;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sue Spence