fastmonkeys / stellar

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

BUG: DATABASE NAME PARSER!! #44

Open izelnakri opened 9 years ago

izelnakri commented 9 years ago

When the target database has '_' in it's database name(ex. postgresql://localhost:5432/railsapp_development), stellar restore command doesn't work properly! This is a terrible bug considering the rails convention to use underscore per rails environment database. The code that parses the database names should take into account this rather "popular" edge-case. It took me few hours to find out this bug.

I guess this person had the same issue: https://github.com/fastmonkeys/stellar/issues/27

izelnakri commented 9 years ago

After few more tries Im not sure if the problem is name parsing but restore command certainly doesn't work for me:

File "/Library/Python/2.7/site-packages/sqlalchemy/engine/default.py", line 435, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (OperationalError) terminating connection due to administrator command server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. 'SHOW server_version;' {}

izelnakri commented 9 years ago

I found the solution. If you don't have a database with the unix user (meaning if you cannot access your postgres terminal by just psql command, but you can access with typing the database name directly; psql my_database_name). Stellar simply doesn't work. Stellar follows the postgres convention: http://www.revsys.com/blog/2007/may/16/common-postgresql-problem/ . This should have been indicated in the README.MD, it could have saved me hours!

Teemu commented 9 years ago

Yes this is a known problem. You can either create a database with the name of the user or you can use configuration like this:

project_name: pelsu
stellar_url: postgresql://localhost:5432/stellar_data
tracked_databases: [pelsu]
url: postgresql://localhost:5432/postgres

In this example, the url is refering to database 'postgres' which seems to be included in every installation. Please note it may not be same as one of the tracked databases.

izelnakri commented 9 years ago

README.md explanation would be great.

Teemu commented 9 years ago

I added a warning to README.md. I'm hoping I will be able to fix this issue in software.