Trouble Restoring XBRL SEC DB in Postgres

94 views
Skip to first unread message

Jeremy

unread,
Sep 16, 2016, 11:33:26 AM9/16/16
to Arelle-users

I downloaded the xbrldb_SEC_pg_2014-11-02.pg.gzip postgres pg_dump file from arelle.org. I then ran the schema ddl file in pgAdminIII and it recreated all of the databases, functions, etc.


When I try to restore the databases using the following:

desktop:~/Downloads$ sudo postgres zcat xbrldb_SEC_pg_2014-11-02.pg.gzip | psql -U postgres public

I get: sudo: postgres: command not found psql: FATAL: Peer authentication failed for user "postgres"


I can zcat the file into a file to expand it. Looks like it is a pg_dump file.


postgres=> pg_restore -a /home/jeremy/Downloads/xbrldb_SEC_pg_2014-11-02.txt postgres-> ; ERROR: syntax error at or near "pg_restore" LINE 1: pg_restore -a /home/jeremy/Downloads/xbrldb_SEC_pg_2014-11-0... ^ postgres=> pg_restore -a postgres /home/jeremy/Downloads/xbrldb_SEC_pg_2014-11-02.txt; ERROR: syntax error at or near "pg_restore" LINE 1: pg_restore -a postgres /home/jeremy/Downloads/xbrldb_SEC_pg_...


So then I tried to use PG Admin III, and my output: /usr/bin/pg_restore --host localhost --port 5432 --username "postgres" --dbname "public" --role "postgres" --no-password --section data --data-only --exit-on-error --table accession --schema public --verbose "/home/jeremy/Downloads/xbrldb_SEC_pg_2014-11-02.backup" pg_restore: [archiver] input file appears to be a text format dump. Please use psql.

Process returned exit code 1.


May I please ask what I need to do to get the databases restored?

Does anyone know what I need to do to get the database updated from 2014-11-02 to the current date?


Note this is on Ubuntu 16.04.

Jeremy

unread,
Sep 18, 2016, 11:28:24 AM9/18/16
to Arelle-users
FYI, I resolved the database loading issue on my own.

My steps:
1. In PG Admin III:
> create database public;

On the command line:
> gunzip -c xbrldb_SEC_pg_2014-11-02.pg.gzip > xbrldb_SEC_pg_2014-11-02.backup
> psql public < xbrldb_SEC_pg_2014-11-02.backup

Save the XBRL public schema ddl to your computer, and run all of the non-create database commands.

It takes about a day to build and load the database.
Reply all
Reply to author
Forward
0 new messages