opengeospatial / geopackage-related-tables

A proposed GeoPackage extension for related tables
Other
3 stars 6 forks source link

ATS for Requirement 4 - PRAGMA does not show UNIQUE constraint, only PK #51

Closed tabinfl closed 2 years ago

tabinfl commented 6 years ago
1. PRAGMA table_info(gpkgext_relations) 
[...]
3. Pass if the column names, types, nullability, default values,
primary key, and unique key constraints match all of those in
the contents of [gpkgext_relations_table].

The PRAGMA query return data allows checking everything but the UNIQUE constraint on the mapping_table_name field.

could add

PRAGMA index_list(gpkgext_relations);

to check for unique = 1 and then

PRAGMA index_info({index_name});

to verify that it's on the correct (mapping_table_name) column.

There may be an easier way, I keep running into sqlite's limited SQL.

bradh commented 6 years ago

I think this is the only sane way - there is code that does something similar in the ETS core. It would be possible to parse the schema to see how the table was created, but that is probably too brittle.

jyutzler commented 6 years ago

I think @bradh is referring to https://github.com/opengeospatial/ets-gpkg12/blob/master/src/main/java/org/opengis/cite/gpkg12/CommonFixture.java#L243.

jyutzler commented 2 years ago

moved to :point_up: