Opened 10 years ago

Closed 10 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 Alex Krupp)

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 Alex Krupp, 10 years ago

Description: modified (diff)

comment:2 by Tim Graham, 10 years ago

Component: contrib.postgresDocumentation
Easy pickings: set
Owner: set to nobody
Triage Stage: UnreviewedAccepted

The migration operations would look like this:

operations = [
    HStoreExtension(),
]

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.

comment:3 by Tim Graham, 10 years ago

Summary: Add details for installing extensionsAdd details for installing postgres extensions

comment:4 by Troy Grosfield, 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:5 by Tim Graham, 10 years ago

Has patch: set

How does this pull request look?

comment:6 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 9ef2615:

Fixed #24811 -- Added details on installing PostgreSQL extensions.

comment:7 by Tim Graham <timograham@…>, 10 years ago

In 9def46c:

[1.8.x] Fixed #24811 -- Added details on installing PostgreSQL extensions.

Backport of 9ef2615d4968ed52dbd88a19f03746a2f16c7511 from master

comment:8 by Madeleine Price Ball, 10 years ago

Patch needs improvement: set
Resolution: fixed
Status: closednew

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 Tim Graham, 10 years ago

Owner: changed from nobody to Tim Graham
Status: newassigned

Thanks for the report. I think we can use the syntax from the PostgreSQL docs which omits any quotes.

comment:10 by Tim Graham <timograham@…>, 10 years ago

In c954931:

Refs #24811 -- Fixed syntax error in CREATE EXTENSION example query.

comment:11 by Tim Graham <timograham@…>, 10 years ago

In b8dce1af:

[1.8.x] Refs #24811 -- Fixed syntax error in CREATE EXTENSION example query.

Backport of c954931abd17f8efaa6b7662ac2916dbf47d2978 from master

comment:12 by Tim Graham, 10 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.
Back to Top