def register_type_handlers(connection, **kwargs): if connection.vendor != 'postgresql' or connection.alias == NO_DB_ALIAS: return try: oids, array_oids = get_hstore_oids(connection.alias) register_hstore(connection.connection, globally=False, oid=oids, array_oid=array_oids) except ProgrammingError: # Hstore is not available on the database. # # If someone tries to create an hstore field it will error there. # This is necessary as someone may be using PSQL without extensions # installed but be using other features of contrib.postgres. # # This is also needed in order to create the connection in order to # install the hstore extension. pass
def test_hstore_values(self): oids, array_oids = get_hstore_oids(connection.alias) self.assertOIDs(oids) self.assertOIDs(array_oids)
def test_hstore_cache(self): get_hstore_oids(connection.alias) with self.assertNumQueries(0): get_hstore_oids(connection.alias)
def test_hstore_cache(self): with self.assertNumQueries(0): get_hstore_oids(connection.alias)