RedQueryBuilder
RedQueryBuilder copied to clipboard
Uncaught java.lang.IllegalArgumentException: Duplicate value: com.redspr.redquerybuilder.core.client.expression.ExpressionColumn$ColumnCommand@39175796
This is caused when using the following metadata.
{
"meta": {
"tables": [
{
"name": "country",
"label": "country",
"columns": [
{
"name": "area",
"label": "area",
"type": "INTEGER"
},
{
"name": "capital",
"label": "capital",
"type": "STRING"
},
{
"name": "code",
"label": "code",
"type": "STRING"
},
{
"name": "province",
"label": "province",
"type": "STRING"
},
{
"name": "countryname",
"label": "countryname",
"type": "STRING"
},
{
"name": "population",
"label": "population",
"type": "INTEGER"
}
],
"fks": []
},
{
"name": "city",
"label": "city",
"columns": [
{
"name": "country",
"label": "country",
"type": "STRING"
},
{
"name": "cityname",
"label": "cityname",
"type": "STRING"
},
{
"name": "latitude",
"label": "latitude",
"type": "STRING"
},
{
"name": "id",
"label": "id",
"type": "INTEGER"
},
{
"name": "population",
"label": "population",
"type": "STRING"
},
{
"name": "longitude",
"label": "longitude",
"type": "STRING"
}
],
"fks": [
{
"referencedTableName": "country",
"name": "city_country_fkey",
"label": "country",
"foreignKeyNames": [
"country"
],
"referencedKeyNames": [
"code"
],
"reverseLabel": "city"
}
]
}
],
"types": [
{
"name": "STRING",
"editor": "TEXT",
"operators": [
{
"name": "=",
"label": "is",
"cardinality": "ONE"
},
{
"name": "<>",
"label": "is not",
"cardinality": "ONE"
},
{
"name": "LIKE",
"label": "like",
"cardinality": "ONE"
},
{
"name": "CONTAINS",
"label": "contains",
"cardinality": "ONE"
}
]
},
{
"name": "DATE",
"editor": "DATE",
"operators": [
{
"name": "=",
"label": "is",
"cardinality": "ONE"
},
{
"name": "<>",
"label": "is not",
"cardinality": "ONE"
},
{
"name": "<",
"label": "before",
"cardinality": "ONE"
},
{
"name": ">",
"label": "after",
"cardinality": "ONE"
}
]
},
{
"name": "INTEGER",
"editor": "NUMBER",
"operators": [
{
"name": "=",
"label": "is",
"cardinality": "ONE"
},
{
"name": "<>",
"label": "is not",
"cardinality": "ONE"
},
{
"name": ">",
"label": "greater than",
"cardinality": "ONE"
},
{
"name": "<",
"label": "less than",
"cardinality": "ONE"
}
]
},
{
"editor": "SELECT",
"name": "BOOLEAN",
"operators": [
{
"name": "=",
"label": "is",
"cardinality": "ONE"
}
]
}
]
},
"editors": [
{
"name": "DATE",
"format": "dd.MM.yyyy"
}
]
}
It doesn't like that the FK names "city" and "country" clash with the column names "city" and "country".
Quick fix would be to use different labels for one or the other.
I'll try and think of some better ways for RQB to handle this.
I've used a workaround of changing the label on the foreign tables to include an ellipsis ("country ...") and that seems to work, so yes it definitely the labels clashing.