For example, let's say I wanted to import a CSV file from a path on the same computer where the postgres server is running.
The system has the environment variable MyPath '/path/to/my/csv/file/' .
I could easily import this CSV file as follows:
COPY MyTable FROM '/path/to/my/csv/file/myTable.csv' DELIMITERS ',' CSV HEADER;
Is it possible to refer to the MyPath variable from this sql postgres command? Something in the following lines:
COPY MyTable FROM get_environmental_variable('MyPath') || 'myTable.csv' DELIMITERS ',' CSV HEADER;
source share