https://bugs.documentfoundation.org/show_bug.cgi?id=152687

            Bug ID: 152687
           Summary: Form Combobox Not Working With Postgres
           Product: LibreOffice
           Version: 7.4.3.2 release
          Hardware: All
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Base
          Assignee: [email protected]
          Reporter: [email protected]

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

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to