Opened 9 years ago

Last modified 6 years ago

#2850 new defect

v.db.update: value=NULL treated as text with NULL put between quotes

Reported by: mlennert Owned by: grass-dev@…
Priority: normal Milestone: 7.6.2
Component: Vector Version: svn-releasebranch70
Keywords: v.db.update NULL Cc:
CPU: Unspecified Platform: Unspecified

Description

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.

Change History (6)

comment:1 by neteler, 9 years ago

Milestone: 7.0.3

Ticket retargeted after milestone closed

comment:2 by neteler, 9 years ago

Milestone: 7.0.4

Ticket retargeted after 7.0.3 milestone closed

comment:3 by martinl, 9 years ago

Milestone: 7.0.47.0.5

comment:4 by neteler, 8 years ago

Milestone: 7.0.57.0.6

comment:5 by neteler, 7 years ago

Milestone: 7.0.67.0.7

comment:6 by martinl, 6 years ago

Milestone: 7.0.77.6.2

Still relevant.

Note: See TracTickets for help on using tickets.