minus34/gnaf-loader

Postgres DB without a role named 'postgres' fails

alexgleith opened this issue · 3 comments

So running the script on a database without the postgres user role fails. (This is default when installing PG using homebrew, I think)

Here's the error:

Part 1 of 3 : Start raw GNAF load : 2016-02-26 14:00:22.543925 - Step 1 of 6 : tables dropped : 0:00:00.003236 - Step 2 of 6 : database NOT vacuumed Traceback (most recent call last): File "load-gnaf.py", line 621, in <module> main() File "load-gnaf.py", line 132, in main create_raw_gnaf_tables(pg_cur) File "load-gnaf.py", line 210, in create_raw_gnaf_tables pg_cur.execute(sql) psycopg2.ProgrammingError: role "postgres" does not exist

I was able to get past this by creating a postgres role.

This is an assumption, which I assume is throughout the .sql files. Perhaps this 'OWNER' should be the database user, and find/replaced at runtime?

Added code to replace 'postgres' user name in create tables script to input user name.

I'm still getting this error currently at the master branch:

Traceback (most recent call last):
  File "./gnaf-loader/load-gnaf.py", line 951, in <module>
    if main():
  File "./gnaf-loader/load-gnaf.py", line 93, in main
    create_raw_gnaf_tables(pg_cur, settings)
  File "./gnaf-loader/load-gnaf.py", line 327, in create_raw_gnaf_tables
    pg_cur.execute(sql)
psycopg2.ProgrammingError: role "postgres" does not exist

It needs:

createuser postgres --superuser

To complete the load operation.

Thanks, that was a bug that's now been fixed.