Opened 11 years ago

Closed 11 years ago

#185 closed defect (worksforme)

division with dbf driver leads to protocol error

Reported by: mlennert Owned by: grass-dev@…
Priority: major Milestone: 6.4.0
Component: Default Version: 6.3.0
Keywords: dbf division Cc:
CPU: Unspecified Platform: Unspecified

Description

The help page on the dbf driver says "Arithmetic expressions using constants and field values are allowed in condition clauses and in the RHS of assignments".

I can confirm that these work:

v.db.update map=ilots col=prop_popmo value='P_UNDER_5+P5_TO_9'
v.db.update map=ilots col=prop_popmo value='P_UNDER_5-P5_TO_9'
v.db.update map=ilots col=prop_popmo value='(P_UNDER_5+P5_TO_9)*TOTAL_POP

However,

v.db.update map=ilots col=prop_popmo value='(P_UNDER_5+P5_TO_9)/TOTAL_POP'

gives me the following error:

ERROR: This should not happen: got a wrong expression structure after
       parsing.
dbmi: Protocol error
ERROR: Error while executing: 'UPDATE ilots SET
       prop_popmo=(P_UNDER_5+P5_TO_9)/TOTAL_POP
       '

Change History (1)

comment:1 Changed 11 years ago by mlennert

CPU: Unspecified
Platform: Unspecified
Resolution: worksforme
Status: newclosed

The problem is division by 0, if I use

v.db.update map=ilots col=prop_popmo value='(P_UNDER_5+P5_TO_9)/TOTAL_POP' where="TOTAL_POP>0"

it works.

Maybe the error message could be enhanced, but it's not really a bug, so closing it.

Note: See TracTickets for help on using tickets.