As far as I know, the "Value Relation Widget" is supposed to store the records from the field designated as KEY COLUMN in the attribute table, while the records from the field designated as VALUE COLUMN are the ones that should only be displayed in the attribute form instead of the records from the field designated as KEY COLUMN, i.e. as a sort of a "hint" to the user. In my experience, the widget does not behave as expected, and I don't know if I'm doing something wrong or just misunderstanding how it works.
Here's an example (QGIS version 3.22.5 "Białowieża"):
I created a Geopackage named "test_value_relation_widget.gpkg".
Then I created a table named "places_types" with no geometry and two fields: "type_id" and "type_name":
Then I put some records into both fields:
Then I created another table named "places" with three fields: "place_name", "place_type_VR_key_fid" and "place_type_VR_key_type_id". The second and the third fields should be used to test two different scenarios:
In the first case, in the Value Relation widget, the Key column points to the "fid" of the "places_types" table, and the Value column points to the "type_name" field:
In the second case, in the Value Relation widget, the Key column points to the "type_id" field of the "places_types" table, and the Value column again points to the "type_name" field:
Then I created some points and selected the values. As expected, I saw the records from the Value column displayed in the attribute form:
As a result, in both cases, the attribute table does not contain the records from the fields, designated as Key column(s) but those from the Value column:
Even after saving the project to the Geopackage, restarting QGIS, and reopening the project, nothing changes.
Please advise.
PS I'm somewhat surprised that even if the data type of a field is defined as an integer, the Value Relation widget can store a text string in it, for example, "village" instead of "1", "town" instead of "2" etc.