Opened 6 years ago

Closed 6 years ago

#29965 closed Bug (needsinfo)

Postgresql hstore extension not initialized in testing

Reported by: David Vogt Owned by: nobody
Component: contrib.postgres Version: 2.1
Severity: Normal Keywords: hstore, postgresql
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm using pytest-django, so I'm not 100% sure this belongs here or with pytest-django itself, but nonetheless:

In one of my projects, I'm using HStore fields from the django.contrib.postgres package. The HStore extension needs to be registered with psycopg2 on a per-connection basis. changeset:f7b0532ec0cf703849ef (as a followup to changeset:86a18dc46a) skips registering on "unknown" databases, which then leads to the extension missing when running tests.

It seems that the extension is properly registered when creating the DB for each test run, but not when reusing it.

The current workaround is a custom signal handler on connection_created to call psycopg2.exttras.register_hstore() explicitly (without OID parameters, so it forces auto-detection).

Change History (2)

comment:1 by Tim Graham, 6 years ago

Component: Uncategorizedcontrib.postgres
Type: UncategorizedBug

This ticket tracker isn't a support channel to get help debugging your issue. Can you please investigate it and determine whether or not Django is at fault (or get help at TicketClosingReasons/UseSupportChannels)? At the very least, you should provide a sample project with steps to reproduce the issue (and one that doesn't use pytest-django, to rule out an issue there).

comment:2 by Tim Graham, 6 years ago

Resolution: needsinfo
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top