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

Escape special characters in password while db loading #2952

Closed
drnextgis opened this issue Apr 12, 2016 · 10 comments
Closed

Escape special characters in password while db loading #2952

drnextgis opened this issue Apr 12, 2016 · 10 comments
Assignees

Comments

@drnextgis
Copy link

@drnextgis drnextgis commented Apr 12, 2016

CKAN doesn't escape special symbols within password.

Restore procedure:

paster db load -c /etc/ckan/default/production.ini my_database_dump.sql

in my case produces the following invalid command:

PGPASSWORD=Ab1239idap&u && psql -U ckan_default -h localhost -d ckan_default -f /mnt/portal/tmp/ckan.pg_dump
[1] 26628
-bash: u: command not found
@wardi
Copy link
Contributor

@wardi wardi commented Apr 12, 2016

I'd prefer to remove the "db load" command and instead just document how to dump and restore using the postgres tools directly.

@torfsen
Copy link
Contributor

@torfsen torfsen commented Apr 12, 2016

@wardi: According to the documentation, db load also automatically performs DB migrations if the data comes from an older CKAN version. That is a really nice feature that you won't get by using the raw postgres tools.

@wardi
Copy link
Contributor

@wardi wardi commented Apr 12, 2016

This command prevents users from using a bunch of the useful options available in pg_dump/pg_restore and I don't think it's really much of a burden to run paster db upgrade after restoring the db.

If you really like db load and are willing to fix this issue I won't refuse the fix. I think it's really useful to know that you don't need ckan in order to perform a backup or restore, though.

@torfsen
Copy link
Contributor

@torfsen torfsen commented Apr 12, 2016

Ah, I wasn't aware of the db upgrade command (the online documentation doesn't mention it explicitly and I never checked paster db --help before). In that case you're probably right and db load can be removed. A section in the docs describing the full database dump/restore/upgrade cycle would be useful then.

@TkTech
Copy link
Member

@TkTech TkTech commented Apr 12, 2016

+1 for removing db load in favour of improved documentation.

@mattfullerton
Copy link
Contributor

@mattfullerton mattfullerton commented Apr 13, 2016

@torfsen, it is documented where it needs to be though, albeit slightly hidden: http://docs.ckan.org/en/latest/maintaining/upgrading/upgrade-source.html#upgrading-a-source-install

@torfsen
Copy link
Contributor

@torfsen torfsen commented Apr 13, 2016

@mattfullerton: Yeah, it's also described at database migrations. However, the command line interface page always had an "exhaustive" look and feel to me. From there I learned that db load does the necessary migrations and that's all that I've ever needed 😉

Perhaps the paster reference could be auto-generated so that the reference and paster --help / paster command --help contain the same information.

@dancastellani
Copy link

@dancastellani dancastellani commented Apr 26, 2016

Hi, I'm having the same password problem but with paster pg dump.
Is that fixed already?
If not, I fixed it on my CKAN and can submit a fix for the paster pg dump.

Please let me know. Thanks

@torfsen
Copy link
Contributor

@torfsen torfsen commented Jul 7, 2016

Can this be re-opened until the discussed documentation improvements have been implemented? This is still affecting users, see for example this Stack Overflow question that was posted today.

@wardi wardi reopened this Jul 7, 2016
torfsen added a commit to torfsen/ckan that referenced this issue Jul 8, 2016
Deprecates the paster commands `db load` and `db dump` in favor of
PostgreSQL's `pg_dump` and `pg_restore`. `db load` and `db dump` are
kept but print a warning, and their documentation is replaced with a
documentation of how to dump/import the database using `pg_dump` and
`pg_restore`.
@wardi wardi closed this in #3158 Jul 9, 2016
wardi added a commit that referenced this issue Jul 9, 2016
@NicolaiMogensen
Copy link

@NicolaiMogensen NicolaiMogensen commented Feb 15, 2017

The command sudo -u postgres pg_dump --format=custom -d ckan_default > ckan.dump is invalid syntax in Postgresql 9.5 omitting the -d works as intended

EDIT: Apparently it is fine in pg_restore weird.

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

Successfully merging a pull request may close this issue.

7 participants