Possible bug in foreign keys

46 Views Asked by At

I think I may have found a bug in the tardis branch.

It appears that if a foreign key is specified it no longer adds an additional field Listbox with fields from the foreign key table.

In the example at appspot, if I select COUNTRY as the table, then select "City" from the leftmost gwt-Listbox it adds another gwt-Listbox with the fields from the City table that I can select against.

In the Tardis branch, the label from the fks array shows up in the field selection in my case "campaign".

If I select the label I have created, "campaign", nothing happens.

If I select the label a second time, it updates the list of fields in the first Listbox with the field names from the "campaign" table, but it does this in the first box.

I was expecting something like:

campaign | campfields | (is|is not|etc)

What I am seeing is

campfields | (is|is not|etc)

My fks specification looks like the following:

"fks": [
            {
                "referenceTableName": "campdetail",
                "reverseLabel": "Campaign",
                "foreignKeyNames": "dpu_id",
                "referencedKeyNames": "dpu_id",
                "name": "campdetail_IBFK_1",
                "label": "campaign"
            } 
]

I wanted to see if there a problem with how I am specifying the foreign key, or if this is an actual bug that needs a bug report filed.

Thanks in advance, Scott

1

There are 1 best solutions below

2
salk31 On BEST ANSWER

Looking at http://1-7-0.redquerybuilder.appspot.com/ (tardis branch but normal meta data) it seems to be working OK.

By default the foreign key will show up as a normal scalar with associated operators unless you hide it.

Your meta data looks dodgy. Should be more like:

{
  "referencedTableName": "COUNTRYLANGUAGE",
  "name": "COUNTRYLANGUAGE_IBFK_1",
  "label": "Language",
  "foreignKeyNames": [
    "CODE"
  ],
  "referencedKeyNames": [
    "COUNTRYCODE"
  ],
  "reverseLabel": "Country"
}

So at least a missing "d" from referencedTableName... I'd expect some horrible stack trace if that is the data you used.

Hope that helps!?