On Fri, February 19, 2021 15:00, James B. Byrne wrote:
> I used pgadmin4 to create a dump file in plain sql.
>
> I am trying to use this file to populate a test database on another postgresql
> host. I can find the file previously created. It appears correct:
>
> [root@vhost01 ~ (master)]# file
> /var/db/pgadmin4/storage/admin_harte-lyne.ca/redmine_backup_locate.sql
> /var/db/pgadmin4/storage/admin_harte-lyne.ca/redmine_backup_locate.sql: ASCII
> text, with very long lines
>
> [root@vhost01 ~ (master)]# more
> /var/db/pgadmin4/storage/admin_harte-lyne.ca/redmine_backup_locate.sql
> --
> -- PostgreSQL database dump
> --
>
> -- Dumped from database version 9.6.17
> -- Dumped by pg_dump version 12.5
>
> -- Started on 2021-02-19 14:32:31 EST
>
> SET statement_timeout = 0;
> SET lock_timeout = 0;
> . . .
>
> The target database exists on the target host. However, when I try to run the
> restore function in pgadmin4 I get this error:
>
> /usr/local/bin/pg_restore --host "pgsql-dbms.internal.hamilton.harte-lyne.ca"
> --port "5432" --username "postgres" --no-password --role "postgres" --dbname
> "hll_redmine_copy" --verbose
> "/var/db/pgadmin4/storage/admin_harte-lyne.ca/redmine_backup_locate.sql
>
> pg_restore: error: input file appears to be a text format dump. Please use
> psql
>
>
>
> Is there no way to restore from an sql file from within pgadmin4?
>
>
I can load it as an SQL query of course. And I tried that. But the dump file
contains this line which causes the query to fail:
ERROR: syntax error at or near "\"
LINE 32: \connect hll_redmine_copy
^
SQL state: 42601
Character: 845
I have removed this and will try again. But the existence of that line in an
SQL dump is a bit disconcerting.
--
*** e-Mail is NOT a SECURE channel ***
Do NOT transmit sensitive data via e-Mail
Unencrypted messages have no legal claim to privacy
Do NOT open attachments nor follow links sent by e-Mail
James B. Byrne mailto:byrn...@harte-lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3