[postgis-devel] pg_opclass and schema awareness

Markus Schaber schabi at logix-tt.com
Tue Apr 19 07:46:14 PDT 2005


Hi,

I just wanted to bring this issue up onto the table, as it was held back
due to the 1.0.0 freeze. (see below)

Is this change the correct fix? Should I commit it, or is it better to
fix all schema issues at once?

Maybe it would simply be the best to tell our users not to install
different PostGIS versions into different schemas of the same database.

Markus

Markus Schaber schrieb:
> Hi, strk,
> 
> strk at refractions.net schrieb:
> 
> 
>>>It should be possible having different directories, as postgresql uses
>>>full qualified file names. But I have to admit that you cannot simply
>>>use "make install" unmodified.
>>
>>Since you pointed out... actually you can ;)
>>LPATH=/usr/src/postgis-modified make 
> 
> 
> Okay - I used a search/replace on lwpostgis.sql :-)
> 
> Here's the proof - two different compilations of the same postgis
> version in two different schemas in the same database:
> 
> multipostgis=# select
> schabi.postgis_lib_build_date(),schabi.postgis_version(),postgres.postgis_lib_build_date(),postgres.postgis_version();
>  postgis_lib_build_date |            postgis_version            |
> postgis_lib_build_date |            postgis_version
> ------------------------+---------------------------------------+------------------------+---------------------------------------
>  2005-03-01 17:19:32    | 1.0 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 |
> 2005-03-01 17:22:27    | 1.0 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
> (1 Zeile)
> 
> But, besides the library path, I also needed to comment out the lines
> 640-642 of lwpostgis.sql because the subselect returned more than one row.
> 
> UPDATE pg_opclass
>       SET opckeytype = (select oid from pg_type where typname = 'box2d')
>       WHERE opcname = 'gist_geometry_ops';
> 
> I'm afraid that this could break the GIST indices for schema users, we
> should constrain the subselect to current_schema(). The following should
> do this:
> 
> 
> UPDATE pg_opclass
>     SET opckeytype = (SELECT oid FROM pg_type
>                       WHERE typname = 'box2d'
>                       AND typnamespace=(SELECT oid FROM pg_namespace
>                                         WHERE nspname=current_schema()))
>     WHERE opcname = 'gist_geometry_ops'
>     AND opcnamespace = (SELECT oid from pg_namespace
>                         WHERE nspname=current_schema());
> 
> Strk, could you verify this?
> 
> Markus




More information about the postgis-devel mailing list