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

            Bug ID: 155529
           Summary: MariaDB direct connection: Trying to insert NULL in
                    NOT NULL fields will automatically changed in empty
                    text or 0
           Product: LibreOffice
           Version: 6.3.0.4 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Base
          Assignee: [email protected]
          Reporter: [email protected]

Open a connection to MariaDB (or MySQL).
Create a table by Tools → SQL:

CREATE TABLE `tblTest` (
  `ID` int NOT NULL PRIMARY KEY,
  `Name` varchar(255) COLLATE latin1_german1_ci NOT NULL,
  `Number` int NOT NULL
);

Note: No field should be NULL!
Refresh table view.
Open this table for input data.
Type a value for "ID" and for "Name" and go to next record.
No error appears.
There will automatically added '0' for "Number".
Type a value for "ID" and for "Number" and go to next record.
No error appears.
There will automatically added '' for "Name".

Open query editor to see it is an empty text:
SELECT * FROM `tblTest` WHERE `Name` IS NULL
won't show any row.
SELECT * FROM `tblTest` WHERE `Name` = ''
will show the row where no input has been made.

Try the same with JDBC-connection. JDBC-Connection won't save any data if a
field is empty, which shouldn't be NULL.

No driver should automatically add a value if no value has been set by the
user. Blank text in a table is NULL by default, blank fields in a field for any
other content is NULL.

If I create a form it will be possible to set the properties for an empty
field. Default here is to send NULL to the database. But this won't work with
internal driver for MySQL/MariaDB.

Tested here with LO 7.4.7.2 on OpenSUSE 15.4 64bit rpm Linux
Same behavior with LO 7.5.3.2.
Tested also with LO 6.3.0.4 - same behavior. This is the first version with
direct connection to MariaDB integrated and possibility to input new data in
this kind of table.

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

Reply via email to