help-gnats
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Expected behaviour for absent fields


From: Adrian Ashley
Subject: Expected behaviour for absent fields
Date: Mon, 29 Mar 2004 12:10:31 +0100

I have a GNATS-4 installation with a number of additional fields in the
database.  In this example, "fix-rel" is one of these - defined thusly:

field "fix-rel" {
    description "fix release"
    text matching { "^$" "^(VE|IP)(_[0-9]\+)\+$" }
    textsearch
}

i.e. the empty string or specially formed tag names are allowed.
The other thing to note is that this field isn't included in the
initial-entry fields.

One of our users reports a peculiarity: a query like this:

  $ query-pr --expr \
      'category=="foo" & <more clauses> & (fix-rel != "VE_6")'

doesn't match PRs for which this field is not yet set - and there
doesn't seem to be any way for him to work around this.

Looking at query.c:fieldCompare() and field.c:get_field_value(), it
seems that the latter returns NULL for a field which is not yet set, and
the former concludes that if either of its field values are NULL, the
comparison must be false.

It looks like the right fix is in fieldCompare(), to cope with NULL
meaning empty.  Has anyone been near this code and could advise whether
I'll be breaking something else by doing this?  Or is the problem that
my database has fields that can be unset - am I breaking some rule?

Thanks,
Adrian Ashley
Broadcom Corp.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]