Skip to content

Create linked table fails when the table contains a Geometry with a data type specified #3322

@ebocher

Description

@ebocher

H2 returns a detailed description of the Geometry data type related to its geometry type and srid.
e.g : GEOMETRY(POINT Z) , GEOMETRY(POINT Z, 4326)...

This description causes some troubles when we want to link a table from one H2 db to another H2 db.

Pseudo unit test

        Connection connectionTarget = ...
        Connection linkedDBConnection = ...
        Statement statementLinked = linkedDBConnection.createStatement();
        statementLinked.execute("DROP TABLE IF EXISTS table_to_link;" );
        statementLinked.execute("CREATE TABLE table_to_link  ( the_geom GEOMETRY, the_geom2  GEOMETRY(POINT Z)," +
                "ID INTEGER,  TEMPERATURE DOUBLE PRECISION,  LANDCOVER  VARCHAR)");
        statementLinked.execute("INSERT INTO table_to_link VALUES ('POINT(0 0)', 'POINT(1 1 0)', 1, 2.3, 'Simple points')"+
        ",('POINT(0 1 2)', 'POINT(10 11 12)', 2, 0.568, '3D point')");
        Statement stat = connectionTarget.createStatement();
        stat.execute("CREATE LINKED TABLE LINKED_TABLE('org.h2.Driver', 'jdbc:h2:./target/test-resources/dbH2RegressionTest_linked_db', 'sa', 'sa', 'table_to_link') FETCH_SIZE 100 ");

returns the following error

Unknown data type: "THE_GEOM2"; SQL statement:

The involved method is :

int type = DataType.getValueTypeFromResultSet(rsMeta, i + 1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions