I believe this was just wrong to begin with.  The targetid column is always
negative.  That's how we determine that a call is a to a "target" and not a
direct reference to a function.  Those values will never match
functions.idwhich is always positive.

In the long term I think the callers table should be split into two
(calls_direct and calls_virtual or similar) in which case we could
eliminate the whole negative numbers hack and have proper foreign keys
(calls_direct would have a foreign key to functions.id and calls_virtual
would have a foreign key to targets.id).  That seems like a separate change
though and I didn't want to tackle it here.



On Thu, Dec 19, 2013 at 10:36 AM, Erik Rose <notifications@github.com>wrote:

> In dxr/plugins/clang/indexer.py:
>
> > @@ -251,7 +251,8 @@ def post_process(tree, conn):
> >          ("targetid", "INTEGER", False), # The target of the call
> >          ("funcid", "INTEGER", False),   # One of the functions in the target set
> >          ("_key", "targetid", "funcid"),
> > -        ("_fkey", "targetid", "functions", "id")
> > +        ("_fkey", "funcid", "functions", "id"),
>
> Is there a reason you removed one foreign key to add the other?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/mozilla/dxr/pull/215/files#r8472377>
> .
>