Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Incorrect hstore oid query

#45

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.

Reported by Psycopg website · February 24th, 2011 @ 07:16 PM

State: resolved
Milestone: none
Assigned to: nobody

Activity

  1. Daniele Varrazzo
    Daniele Varrazzo
    • 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.

    https://github.com/dvarrazzo/psycopg/commit/5211e147

    February 25th, 2011 @ 12:41 AM