0

I'd like is to export a table in a postgres server to a local folder (CSV).

I'm using pSQL console, and the command:

COPY (SELECT * FROM <nameTable>) TO 'C/temp/<nameTable>.csv' DELIMITER ',' CSV HEADER;

When I run it, the console shows "ERROR: must be superuser to copy to or from a file". All I've configured is the Server properties (server-user, etc) when I installed pgAdmin III (and I think I did enter a Superuser).

So how can I:

  • Know who the current logged user is, and whether he's a superuser?

  • Change the logged user?

user3310782
  • 811
  • 2
  • 10
  • 18
  • http://stackoverflow.com/questions/8926389/postgresql-user-listing – Ilesh Patel Apr 17 '14 at 10:20
  • Sorry Patel, but I can't see the connection on your reply. I'm newbie to postgres. I've found this export feature on pgAdmin: http://www.pgadmin.org/docs/1.4/export.html but I can't find where it is located on the pgAdmin III interface. – user3310782 Apr 17 '14 at 10:31
  • Go to **PgAdmin III ---> Plguins --> PSQLConsole** Then write **\du** it will list all the users with its roll permission. – Ilesh Patel Apr 17 '14 at 10:38
  • 2
    You want `\copy` not just `copy`; see `\?` – Craig Ringer Apr 17 '14 at 11:22
  • Thanks all, working now. The quickest system I've found is, following Ptel, this: PgAdmin III ---> Plguins --> PSQLConsole SELECT * FROM Finally, File>Export> This probably isn't available in previous versions. – user3310782 Apr 18 '14 at 21:32

0 Answers0