fastmonkeys / stellar

Fast database snapshot and restore tool for development
MIT License
3.86k stars 119 forks source link

postgresql 10.1 pg_stat_activity.procpid does not exist #66

Closed TanookiMario closed 6 years ago

TanookiMario commented 6 years ago

I upgraded to postgresql 10.1 recently and now when trying to take a snapshot i get:

Traceback (most recent call last):
  File "/usr/local/bin/stellar", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/stellar/command.py", line 279, in main
    stellar()
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/stellar/command.py", line 70, in snapshot
    app.create_snapshot(name, before_copy=before_copy)
  File "/usr/local/lib/python2.7/site-packages/stellar/app.py", line 120, in create_snapshot
    table.get_table_name('master')
  File "/usr/local/lib/python2.7/site-packages/stellar/operations.py", line 56, in copy_database
    terminate_database_connections(raw_conn, from_database)
  File "/usr/local/lib/python2.7/site-packages/stellar/operations.py", line 40, in terminate_database_connections
    ''' % {'pid_column': pid_column, 'database': database}
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 939, in execute
    return self._execute_text(object, multiparams, params)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1097, in _execute_text
    statement, parameters
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column pg_stat_activity.procpid does not exist
LINE 2:                 SELECT pg_terminate_backend(pg_stat_activity...
                                                    ^
 [SQL: "\n                SELECT pg_terminate_backend(pg_stat_activity.procpid)\n                FROM pg_stat_activity\n                WHERE\n                    pg_stat_activity.datname = 'checklistpro' AND\n                    procpid <> pg_backend_pid();\n            "]
quantus commented 6 years ago

This was fixed in #63, but it seems like we have forgotten to release a new version on Pypi. Let's keep this ticket open till we get that done.

@Frozenball can you make a new release, or can you give me the rights to do so?

TanookiMario commented 6 years ago

FWIW i followed the directions here and it works perfect! https://github.com/fastmonkeys/stellar/issues/65#issuecomment-358923985