I encountered the dilemma of needing to run some
psql console commands because a colleague needed to use psql's
\i directive in a saved script to execute additional SQL-statements from another file, but I noticed that psql was choking on these files because of some extra garbage characters that pgAdmin was writing to them:
psql:C:/tmp/junk.sql:3: ERROR: syntax error at or near "ï»¿CREATE" LINE 1: ï»¿CREATE TABLE junktable (
psql is needed here because
\i is not an official part of SQL, so it won't run if you send a command like that directly to the database's interpreter, even if it had a way of getting to the files on your local disk.
To keep things simple, I wanted to find a way to allow the PgAdmin's sql-editor to play nice with Postgres so I'm not suddenly telling other people at work to download and install another editor just to get around this; they already know and use pgAdmin.