Postgres ‘COPY’ command can be used to transfer data between text files and database tables, in this article I will discuss how to avoid "ERROR: must be superuser to COPY to or from a file" while using Azure Database for PostgreSQL.
COPY command needs superuser and Azure database for PostgreSQL is a managed PaaS database server that doesn't give the server admin superuser privileges, interested to know why? read this. so if you execute COPY command from PgAdmin or psql utility you will run into the prementioned error as in the following screenshot:
use psql command \copy (as the error message suggests) rather than copy,
\COPY my_table FROM 'C:/Users/bahusse/Desktop/file2.txt' DELIMITERS ',' CSV QUOTE '''';
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.