Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The GeoPackage recommendation for identifier length should be a bit more explicit #687

Open
KRyden opened this issue Sep 12, 2024 · 1 comment

Comments

@KRyden
Copy link

KRyden commented Sep 12, 2024

The GeoPackage standard is a lit loose on the recommendation for maximum identifier length. This is something that should be strengthened in the recommendation statement in section 1.0 of the document where base definitions of the SQLite container are defined.

The current recommendation text block reads:

SQLite is more flexible with regards to identifiers than many other RDBMS systems. If GeoPackage data is to be used in other RDBMS systems, standard practices SHOULD be used to reduce potential interoperability risks. For maximum interoperability, all user-defined GeoPackage table, view, column, trigger, and constraint name values SHOULD start with a lowercase character and only include lowercase characters, numbers 0-9, and underscores (_). In addition, some RDBMS systems truncate identifier names that are longer than a fixed byte length which may be as short as 30 bytes. Therefore, long GeoPackage identifier values SHOULD be avoided and if long identifier values are used, then they SHOULD be unique for at least the first 30 bytes.

For interoperability, 128 characters is a common maximum length for SQL-92 implementations - it is suggested that the above text block be modified to add "exceeding 128 characters" (in bold in the last sentence) as follows:

SQLite is more flexible with regards to identifiers than many other RDBMS systems. If GeoPackage data is to be used in other RDBMS systems, standard practices SHOULD be used to reduce potential interoperability risks. For maximum interoperability, all user-defined GeoPackage table, view, column, trigger, and constraint name values SHOULD start with a lowercase character and only include lowercase characters, numbers 0-9, and underscores (_). In addition, some RDBMS systems truncate identifier names that are longer than a fixed byte length which may be as short as 30 bytes. Therefore, long GeoPackage identifier values exceeding 128 characters SHOULD be avoided and if long identifier values are used, then they SHOULD be unique for at least the first 30 bytes.

This should not have any compatibility issues with GeoPackage versions - it's simply reinforcing best practice for interoperability.

@rouault
Copy link
Contributor

rouault commented Sep 12, 2024

Therefore, long GeoPackage identifier values exceeding 128 characters

I would even lower that to 63 characters, which is the limit of PostgreSQL (cf https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS), a widely used database...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants