When you wish to resolve a foreign key – i.e., get the actual values instead of enumerated values – apply
value to the enumerated column.
Observe that there is no longer an entry in the
What is the use of the above command?
Even without doing `meta update value eid from tdetails` I I can query `tdetails` using dot notation, e.g.: select eid.name, sc from tdetails and automatically get `name` merged in from the `kt`-table. This seems to be the same as after doing the above command.
I've read that enums and their underlying values are not the same (which makes perfect sense), but they behave the same in almost any context. So what's the use of explicitly translating enums to values using the above? Moreover, when changing anything about the enums (adding an enum for example) would I need to rerun this command?
There are a few reasons why you might want to resolve a foreign key:
1. You might want to persist the table to disk and not require the dependency on the other table (if you persisted the tdetails table without persisting the kt table in the same database then you’d have an un-resolvable column)
2. meta doesn’t tell the whole story as the types are very different:
q)type each flip tdetails
sc | 7
q)type each flip update value eid from tdetails
sc | 7
You might require type 7 for compatibility/consistency with something else.
Tel: +44 (0)28 3025 2242
Tel: +1 (212) 447 6700
Tel: +61 (0)2 9236 5700