Re: hstores in pl/python

From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: Florian Pflug <fgp(at)phlo(dot)org>
Cc: Jan Urbański <wulczer(at)wulczer(dot)org>, Dmitriy Igrishin <dmitigr(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: hstores in pl/python
Date: 2010-12-15 20:28:13
Message-ID: m2fwtyrdb6.fsf@2ndQuadrant.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Florian Pflug <fgp(at)phlo(dot)org> writes:
> Not if CREATE EXTENSION allows you install hstore into an arbitrary schema.

It also allows you to change it after the fact, and to easily track it
down. Here's an updated version of the query to find the hstore type OID
reliably once we have extensions in:

dim=# SELECT t.oid
FROM pg_extension_objects('hstore') o
JOIN pg_type t ON t.oid = o.objid
AND o.classid = 'pg_type'::regclass
WHERE t.typname = 'hstore';
oid
-------
16393
(1 row)

For listing all the hstore objects interactively, use \dx hstore.

> For pl/python's purposes, requiring the DBA to set plpython_hstore_type
> accordingly might work, but clients need to be able to reliably find hstore
> too. For them, having to specify the schema of every non-core type your
> database adapter might support isn't exactly ideal...

Another reason why you will like the extension's patch :)

If you think you need the schema where the extension's objects are
living, there it is (for interactive use, just issue \dx):

=# SELECT n.nspname, e.extname
FROM pg_catalog.pg_extension e
LEFT JOIN pg_catalog.pg_depend d ON d.objid = e.oid
AND d.refclassid = 'pg_catalog.pg_namespace'::regclass
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = d.refobjid
WHERE extname = 'hstore';
nspname | extname
---------+---------
utils | hstore
(1 row)

--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2010-12-15 20:40:14 Re: BufFreelistLock
Previous Message Andrew Dunstan 2010-12-15 20:19:20 Re: Complier warnings on mingw gcc 4.5.0