This project is archived and is in readonly mode.
Incorrect hstore oid query
Reported by Psycopg website | February 24th, 2011 @ 07:16 PM
Submitted by: IZ
You use the following query to detect the presence of the hstore type in a database:
SELECT t.oid, %s
FROM pg_type t JOIN pg_namespace ns
ON typnamespace = ns.oid
WHERE typname = 'hstore' and nspname = 'public';
(lines 684-688 of psycopg2/extras.py, function get_oids(self, conn_or_curs))
which is not entirely correct as hstore may be installed in difference schema (but search_path modified properly so that every client sees it), which is actually a good practice (experienced PostgreSQL admins install contribs in their own schemas not to make a big mess in public), though not default behaviour (hstore.sql by default comes to public schema, yes). So I would encourage you to remove "and nspname = 'public'" of the query above, unless you have strong reasons to hold it there.
Many thanks to you for your great work.
Comments and changes to this ticket
-
Daniele Varrazzo February 25th, 2011 @ 12:41 AM
- State changed from new to resolved
No, no strong reason, and thinking about it it's no problem to register the typecaster on all the hstore oids found in the different namespaces.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="https://github.com/psycopg/psycopg2/issues">the new tracker</a>.
<br/>
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.