Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to restore a snapshot causes an "database already exists" error #57

Open
canassa opened this issue Jun 3, 2016 · 1 comment
Open

Comments

@canassa
Copy link

canassa commented Jun 3, 2016

I am getting an "database already exists" error when I try to restore a snapshot

I am using PostgreSQL 9.5.3

Restoring database admin_panel
WARNING:stellar.app:Database admin_panel does not exist.
Traceback (most recent call last):
  File "/home/cesar/venv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
    context)
  File "/home/cesar/venv/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
    cursor.execute(statement, parameters)
psycopg2.ProgrammingError: database "admin_panel" already exists


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/cesar/venv/bin/stellar", line 9, in <module>
    load_entry_point('stellar==0.4.3', 'console_scripts', 'stellar')()
  File "/home/cesar/venv/lib/python3.4/site-packages/stellar/command.py", line 279, in main
    stellar()
  File "/home/cesar/venv/lib/python3.4/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/cesar/venv/lib/python3.4/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/cesar/venv/lib/python3.4/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/cesar/venv/lib/python3.4/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/cesar/venv/lib/python3.4/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/cesar/venv/lib/python3.4/site-packages/stellar/command.py", line 128, in restore
    app.restore(snapshot)
  File "/home/cesar/venv/lib/python3.4/site-packages/stellar/app.py", line 166, in restore
    table.table_name
  File "/home/cesar/venv/lib/python3.4/site-packages/stellar/operations.py", line 125, in rename_database
    to_database
  File "/home/cesar/venv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 906, in execute
    return self._execute_text(object, multiparams, params)
  File "/home/cesar/venv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1054, in _execute_text
    statement, parameters
  File "/home/cesar/venv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
    context)
  File "/home/cesar/venv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
    exc_info
  File "/home/cesar/venv/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/cesar/venv/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 185, in reraise
    raise value.with_traceback(tb)
  File "/home/cesar/venv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
    context)
  File "/home/cesar/venv/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) database "admin_panel" already exists
 [SQL: '\n                ALTER DATABASE "stellar_73c795eb6b0f74db" RENAME TO "admin_panel"\n
@quantus
Copy link
Member

quantus commented Nov 25, 2016

I think there are some weird edge cases where the stellar is not working as it should, but I don't know what is causing this. It might have something to do with different postgres configurations but I don't have time or motivation to start playing with those, as everything works for me.

If someone figures out the issue and creates a PR fixing it, I'll happily merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants