Problem with non public schema in Geoserver

624 views
Skip to first unread message

Simon

unread,
Apr 13, 2012, 11:28:00 AM4/13/12
to OpenQuake Developers
I have my PostGIS database with all the data and PostGIS functions in
a schema called "econd". The public schema is empty.

When create a store I set the schema to "econd".

Then when I try to create a layer from a table I get an error saying
that the relation geometry_columns does not exist. I guessed that was
because Geoserver is looking in the public schema and ignoring the
scheme econd, so I tried creating a duplicate geometry_columns in the
public schema. This worked, I got the layer create screen.

Then I tried "compute from bounds", and get this message:

Caused by: org.postgresql.util.PSQLException: ERROR: type "geometry"
does not exist
Position: 64

This seems to indicate it is again looking in the public schema,
instead of econd.

How can I get around this problem of Geoserver wanting to look in the
public schema when my database is in a different schema?

Simon

unread,
Apr 13, 2012, 12:02:22 PM4/13/12
to OpenQuake Developers
I think I may have answered my own question. I set the schema field in
the store definition to blank. I then set up a search_path variable in
the database set to econd,public. Seems to be working ok now.

Ben

unread,
Apr 14, 2012, 6:16:20 AM4/14/12
to openqu...@googlegroups.com
Hi Simon,
PostGIS manages all of the database geometries with the geometry_columns table in the public schema.
When you add a new geometry column to a table it should be created with the AddGeometryColumn command:

SELECT AddGeometryColumn ('<schema>','<table>','<your_new_geometry_column>',<spacial reference>,'<geometry type>',<dimension>);

example:
SELECT AddGeometryColumn ('gem','pop_vals_ita','the_geom',4326,'POINT',2);

to update existing geometry columns:

SELECT Populate_Geometry_Columns();

then check to see that you geometry_columns table is populated with information about each geom column you have.

If any of those commands fail you may need to explicitly specially enable you db with:

createlang -U geonode -W plpgsql $DB_NAME
psql -U geonode -W -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql $DB_NAME
psql -U geonode -W -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql $DB_NAME

Cheers, Ben

Reply all
Reply to author
Forward
0 new messages