-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Handle dialect that does not exists #8843
Comments
There is no The unknown dialect selection has no effect at all so the default SQL dialect "OGRSQL" is used. |
better runtime warning message and docs at #8844 |
I think, would be better to instead a warning stop it, like when a driver don't exists. We would expect run a particular dialect, if does not exists, I think we should change which one we will use, instead change which one will be used. Thx! |
Maybe, but why users would like to use some undocumented dialect like |
There is several reasons, I think the most important one is that GDAL should use the declared options, just because is what we wanted to use. We can see ogr2ogr out.gpkg sample.csv -sql "select geomfromtext(wkt) as geom from sample"
ERROR 1: Undefined function 'geomfromtext' used. There we need explicitly If GDAL is not compiled with SQLite for example, we would not have that dialect to use, which we also would like to not proceed and know is not available or not exists. Is not weird to write bad some things, even on bash or programming, so is ideal when we wrote bad a file name, don't try to guess which one to use, if a dialect does not exists, don't try to use other. We specify the dialect to use it, even if a SQL Query works in other dialect, we prepared it to work with that specific one, if works with other one is oks, and also causality, which I think, is not good idea to rely on, at least in programming, I think we like luck, but not in code u.u Have the error also helps to handle bugs, if the query works on some systems and don't in others is troublesome, know if the dialect exists or not, to make reproducible code is great! |
Erroring out will probably break some functioning code, but it seems to me like a reasonable change for 4.0.
Are |
Using and documenting the usage of SQL in GDAL is one of the not-so-simple tasks. It may be a mess but unfortunately it is hard to make easy. The default dialect depends on the datasource
Notice that it is not possible to select the PostgreSQL or other native dialects. So if you write always I think that sending a warning about user errors like Would you mind to edit the title to describe the issue better? "Missing GeomFromText" is misleading. |
DEBUG should definitely not be documented. It is for internal testing. |
|
That's even more confusing, does |
The positive thing is that many GDAL utilities already check the user input.
|
Did you read the changes of doc in #8844? Hopefully that should be cleared. Otherwise someone less will need to rephrase as I can't do better
yes that works, although it is unlikely you'd have practical use of it
|
Spatialite has some practical functions which lack from PostGIS so there can be use for SQLite dialect with PostGIS https://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html. |
ExecuteSQL(): add a warning if the dialect name isn't recognized (fixes #8843), and improve doc
Hi all, I was using
GeomFromText
and notice it does not exists on SpatiaLite:With SQLite works:
ogr2ogr out.gpkg sample.csv -dialect sqlite -sql "select geomfromtext(wkt) as geom from sample"
This function is supported by SpatiaLite, is weird to not exists.
I'm using GDAL-3.8.0, with Gentoo-64.
sample.zip
The text was updated successfully, but these errors were encountered: