Description: Given a postgres database as a backend And a One-to-Many table relation When I create a form with a combobox Then my combobox does not work - it shows the FK ID value instead of a label. And when I select another value it treats it as a string and produces an error. Steps to Reproduce: 0. Run a postgres on docker on localhost 1. Create the following tables in postgres create table user_group ( group_id serial primary key, group_name varchar ); create table my_user ( id serial primary key, group_id integer, constraint fk_group foreign key (group_id) references user_group(group_id) ); insert into user_group (group_name) values ('A'), ('B'); insert into my_user (group_id) values (1); 2. Connect to and register your database with "base" 3. Create a form (with or without wizzard) bound to the my_user table 4. Add a combobox related to the user group 5. Use "group_name" as display field 6. Set to update "group_id" in the my_user table 7. Try changing the user's group in "normal" mode Actual Results: Error code: 1 pq_driver: [PGRES_FATAL_ERROR]ERROR: insert or update on table "my_user" violates foreign key constraint "fk_group" DETAIL: Key (group_id)=(0) is not present in table "user_group". (caused by statement 'UPDATE "public"."my_user" SET "group_id" = '0' WHERE "id" = '1'') at /build/libreoffice-fresh/src/libreoffice-7.4.3.2/connectivity/source/drivers/postgresql/pq_statement.cxx:261 Expected Results: The group of the user should be updated. It should be possible to add new groups Reproducible: Always User Profile Reset: Yes Additional Info: N/A
Created attachment 184354 [details] control properties
Only had a look at the screenshot: You have connected the combo box to a field called "group_id". This group_id is an INTEGER, defined in your table. Then you try to fill it with "group_name" - defined as VARCHAR. The field itself will only show INTEGER. Seems you are looking for a list box, not a combo box. List boxes will show the group_name and save the group_id. Try a list box with this code: SELECT "group_name", "group_id" FROM "public"."user_group" Bound field in data should be default (1). So "group_id" will be saved in the table while "group_name" will be shown.
No reaction since nearly a year. Could we close this one as WORKSFORME?
Dear Alexander, This bug has been in NEEDINFO status with no change for at least 6 months. Please provide the requested information as soon as possible and mark the bug as UNCONFIRMED. Due to regular bug tracker maintenance, if the bug is still in NEEDINFO status with no change in 30 days the QA team will close the bug as INSUFFICIENTDATA due to lack of needed information. For more information about our NEEDINFO policy please read the wiki located here: https://wiki.documentfoundation.org/QA/Bugzilla/Fields/Status/NEEDINFO If you have already provided the requested information, please mark the bug as UNCONFIRMED so that the QA team knows that the bug is ready to be confirmed. Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-NeedInfo-Ping