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

Hard to get the type of computed columns (of type DATETIME for example) of GeoPackage views #683

Open
rouault opened this issue Jul 22, 2024 · 0 comments

Comments

@rouault
Copy link
Contributor

rouault commented Jul 22, 2024

This issue is motivated by the issue raised in https://lists.osgeo.org/pipermail/qgis-developer/2024-July/066950.html , that I've analyzed in https://lists.osgeo.org/pipermail/qgis-developer/2024-July/066950.html . This isn't really a GDAL or QGIS issue, but more a general one for anyone using the SQLite3 C "reference" implementation. That is essentially every one, since I don't think there's other implementations.

The issue is when the view has columns that are computed values, and not just the selection of columns from a table. Adding "CAST(my_expr AS {type_name}) AS {field_name}" isn't fully bullet proof. Before SQLite 3.41, if type_name was INTEGER or REAL, then the reported type affinity by PRAGMA TABLE_INFO(view_name) was NUM. Since SQLite 3.42, INT and REAL are distinguished. So far so good. The main remaining issue is with DATETIME fields - for example if computing the min() or max() of a datetime field - as there is no SQLite3 DATETIME type affinity. The only solution for now would be to write a SQL parser for a "CREATE VIEW ..." statement, which is super tedious.

I've no magic solution to propose. One idea that came to mind would be to relax the schema extension to allow the mime_type column to contain any of the values of Table 1. GeoPackage Data Types.

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

1 participant