Opened 10 years ago
Closed 9 years ago
#24811 closed Cleanup/optimization (fixed)
Add details for installing postgres extensions
Reported by: | Alex Krupp | Owned by: | Tim Graham |
---|---|---|---|
Component: | Documentation | Version: | 1.8 |
Severity: | Normal | Keywords: | hstore hstoreextension |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
Currently for installing the Postgres HStoreExtension, the documentation is as follows:
Setup the hstore extension in PostgreSQL before the first CreateModel or AddField operation by adding a migration with the HStoreExtension operation.
However there is no explanation of how to do this. It also seems like the migrations would need to be run as superuser, so doing this in a secure way should be incorporated into the instructions.
Change History (12)
comment:1 by , 10 years ago
Description: | modified (diff) |
---|
comment:2 by , 10 years ago
Component: | contrib.postgres → Documentation |
---|---|
Easy pickings: | set |
Owner: | set to |
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 10 years ago
Summary: | Add details for installing extensions → Add details for installing postgres extensions |
---|
comment:4 by , 10 years ago
I too thought this step was quite confusing. @timgraham, your code example should be included in Django's doc for clarity. However, why isn't the HStoreExtension
migration operation added when you first run python manage.py makemigrations
?
comment:8 by , 9 years ago
Patch needs improvement: | set |
---|---|
Resolution: | fixed |
Status: | closed → new |
I get a syntax error (using Postgres 9.3.7) due to the single quotes when running CREATE EXTENSION IF NOT EXISTS 'hstore';
mydb=# CREATE EXTENSION IF NOT EXISTS 'hstore'; ERROR: syntax error at or near "'hstore'" LINE 1: CREATE EXTENSION IF NOT EXISTS 'hstore'; ^
It works fine with double quotes:
mydb=# CREATE EXTENSION IF NOT EXISTS "hstore"; CREATE EXTENSION
I think the documentation needs to be changed to use double quotes. Thanks!
comment:9 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Thanks for the report. I think we can use the syntax from the PostgreSQL docs which omits any quotes.
comment:12 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The migration operations would look like this:
I thought one could infer that from the instructions, but I guess not. Does that code example make sense?
If the database user doesn't have superuser privileges, then I think the simplest solution is to recommend creating the extension manually, outside of Django migrations.