[Geoserver-devel] Is SQLDialect:includeTable used by Geoserver 2.x

After creating a feature store (I tested for DB2), geoserver is showing the possible feature candidates.
It seems that the geotools method

SQLDialect:
public boolean includeTable(String schemaName, String tableName, Connection cx)

is never called.

Additionally, this makes problems for db2 stores without a db schema name, because all existing views and tables are listed (about 500 in my case, without the schema name, so duplicate entries are possible).

Creating a feature based on the candidates results in a sql exception afterwards, because the schema name is not encoded in the sql string.

The question is: Is a jdbc-ng data store capable of handling multiple schemas. I think not.

For DB2, if the db schema is missing, the schema is the name of the current user in uppercase. I could enforce this fact in the db2 data store implementation, but would it help ?.

Christian Müller ha scritto:

After creating a feature store (I tested for DB2), geoserver is showing the possible feature candidates.
It seems that the geotools method

SQLDialect:
public boolean includeTable(String schemaName, String tableName, Connection cx)

is never called.

It definitely is. Otherwise I would see "geometry_columns" as a table
to import every time I connect to a PostGIS database.
To make sure I've put GS in debug mode and tried listing the tables
in a postgis database to create a new layer, the method was called
a lot of times.

Additionally, this makes problems for db2 stores without a db schema name, because all existing views and tables are listed (about 500 in my case, without the schema name, so duplicate entries are possible).

Creating a feature based on the candidates results in a sql exception afterwards, because the schema name is not encoded in the sql string.

The question is: Is a jdbc-ng data store capable of handling multiple schemas. I think not.

It might well not be. We don't have any test for a schema less
situation. I consider this a bug and it should be solved, though at the
moment I have no time to work on it. But I'll be happy to review patches .

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

You were right, the method is called, my fault, I missed to implement a delegating method. On the other side, including only views and tables having a geometry column causes the geometryless tests and the primarey key tests to fail.

I fixed the problem with the missing database schema name inside the db2 data store factory, anything ok here.

Andrea Aime writes:

Christian Müller ha scritto:

After creating a feature store (I tested for DB2), geoserver is showing the possible feature candidates.
It seems that the geotools method

SQLDialect:
public boolean includeTable(String schemaName, String tableName, Connection cx)

is never called.

It definitely is. Otherwise I would see "geometry_columns" as a table
to import every time I connect to a PostGIS database.
To make sure I've put GS in debug mode and tried listing the tables
in a postgis database to create a new layer, the method was called
a lot of times.

Additionally, this makes problems for db2 stores without a db schema name, because all existing views and tables are listed (about 500 in my case, without the schema name, so duplicate entries are possible).

Creating a feature based on the candidates results in a sql exception afterwards, because the schema name is not encoded in the sql string.

The question is: Is a jdbc-ng data store capable of handling multiple schemas. I think not.

It might well not be. We don't have any test for a schema less
situation. I consider this a bug and it should be solved, though at the
moment I have no time to work on it. But I'll be happy to review patches .

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.