#2850: v.db.update: value=NULL treated as text with NULL put between quotes
------------------------------+---------------------------------
Reporter: mlennert | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.3
Component: Vector | Version: svn-releasebranch70
Keywords: v.db.update NULL | CPU: Unspecified
Platform: Unspecified |
------------------------------+---------------------------------
v.db.update checks the type of the column to be updated and if it is not
integer or double precision the content of the value parameter is
automatically enclosed in single quotes.
This causes a problem with the NULL value as the column is set to contain
the string 'NULL' and not the NULL value.
Currently the check is done as such:
{{{
if coltype.upper() not in ["INTEGER", "DOUBLE PRECISION"]:
value = "'%s'" % value
}}}
We could just do this:
{{{
if coltype.upper() not in ["INTEGER", "DOUBLE PRECISION"] and
value.upper() != 'NULL':
value = "'%s'" % value
}}}
but this would mean that one could not put the string 'NULL' (or 'null')
into a column.
So, we can either decide that one should not use the string 'NULL', or we
have to find a different way to handle the specific value NULL.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2850>
GRASS GIS <https://grass.osgeo.org>