Opened 4 years ago

Last modified 7 months 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 Changed 4 years ago by neteler

Milestone: 7.0.3

Ticket retargeted after milestone closed

comment:2 Changed 4 years ago by neteler

Milestone: 7.0.4

Ticket retargeted after 7.0.3 milestone closed

comment:3 Changed 4 years ago by martinl

Milestone: 7.0.47.0.5

comment:4 Changed 3 years ago by neteler

Milestone: 7.0.57.0.6

comment:5 Changed 21 months ago by neteler

Milestone: 7.0.67.0.7

comment:6 Changed 7 months ago by martinl

Milestone: 7.0.77.6.2

Still relevant.

Note: See TracTickets for help on using tickets.