Bug 92509 - default value for Boolean in Table not working
Summary: default value for Boolean in Table not working
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
4.4.2.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-02 19:26 UTC by jimrussell98116
Modified: 2023-12-06 03:18 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
example database illustrating problem (10.14 KB, application/vnd.oasis.opendocument.database)
2015-07-03 18:09 UTC, jimrussell98116
Details
Try to input new row without any value in boolean-field - won't gett NULL (3.77 KB, application/vnd.oasis.opendocument.database)
2015-12-05 17:31 UTC, Robert Großkopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jimrussell98116 2015-07-02 19:26:04 UTC
In creating a BOOLEAN field in a table, I accepted the default (<none>) as the Default value (as it is what I want). However, on entering data into the table, I find the default is implemented as No.
Comment 1 Alex Thurgood 2015-07-03 07:11:56 UTC
@Jim : what you are describing seems similar to behaviour described in bug 56612 and bug 45606, however, without further description of what exactly it is you have done, e.g. your table definition, or a sample ODB file that shows the problem would be even better, then I'm just guessing.

Please also indicate whether you are using stock TDF provided LibreOffice, or the versions available from the AppStore.

Setting to NEEDINFO, pending requested information.
Comment 2 jimrussell98116 2015-07-03 18:09:35 UTC
Created attachment 117033 [details]
example database illustrating problem

See ClipSurvey, newBoolean field
Comment 3 jimrussell98116 2015-07-03 18:35:39 UTC
Not sure earlier comment update made it into record.

It turns out that the problem is a little more subtle than I appreciated. I had an existing table with ~180 rows of data. I edited the table definition, adding several Boolean fields. The value of these fields for all existing rows got set to No, even though in editing the table I had accepted the default of <none> for default value. 

On the other hand, if I subsequently add a new row, its default values are all handled correctly.

So, it is only during editing of the table definition, not during "normal" data entry, that the incorrect default value is inserted. That is, this is a narrower (but still real) problem than I realized.
Comment 4 Robert Großkopf 2015-12-05 17:31:00 UTC
Created attachment 121055 [details]
Try to input new row without any value in boolean-field - won't gett NULL

Have tested thsi with a single table: 
Created a table with three fields (Primarykey, name and boolean field).
Leave the boolean field as Default <none>.
Saved the table.
Typed in two rows without touching the boolean field.
Boolean field isn't shown as <none> but shown as 'false'.
Boolean field is saved as 'false' (or '0').
The created query for boolean field IS NULL will only show an empty row.

So I set this bug to NEW.
Tested with LO 5.0.4.1, OpenSUSE 64bit rpm Linux.
Comment 5 Lionel Elie Mamane 2015-12-09 07:36:55 UTC
(In reply to jimrussell98116 from comment #3)

> It turns out that the problem is a little more subtle than I appreciated. I
> had an existing table with ~180 rows of data. I edited the table definition,
> adding several Boolean fields. The value of these fields for all existing
> rows got set to No, even though in editing the table I had accepted the
> default of <none> for default value. 

With LibreOffice 5.0.3.2 on Debian GNU/Linux amd64, opened ExampleDB (attachment 117033 [details]). Edited table ClipSurvey. Added a boolean field named "rar". Save, close. Open ClipSurvey (data sheet mode). The value of rar is NULL everywhere.
Comment 6 Robert Großkopf 2016-04-18 15:23:52 UTC
Have tried this one a little bit more:
If I set in SQL
ALTER TABLE "Tablename" ALTER COLUMN "Bool" SET DEFAULT TRUE
the SQL-default should be chosen if the field is NULL while inserting new data.

If you try this with the attached database, the boolean-field will never be TRUE. The GUI of the table will always chose FALSE instead.

If you try to input data through SQL directly the boolean-field will be TRUE, if there isn't a value chosen for it.

Just another hint for the wrong behavior of the GUI for the table. All fields without input should be NULL - also the boolean-field.
Comment 7 Julien Nabet 2016-04-23 15:57:09 UTC
On pc Debian x86-64 with master sources updated today, I reproduce this.

The problem doesn't seem when defining fields of the table since the behaviour described by Lionel (and that I reproduced) shows no default value is taken into account.
The problem is clicking on last row to insert a new row. It should show the no default value boolean fields with a "-" instead of nothing (which means "No").

Lionel: I tried to find the root cause by putting a break point on with svt::EditBrowseBox::MouseButtonDown but got nothing (or perhaps haven't been enough patient), any idea about a code pointer?
Comment 8 QA Administrators 2017-05-22 13:25:54 UTC Comment hidden (obsolete)
Comment 9 QA Administrators 2019-12-03 14:41:53 UTC Comment hidden (obsolete)
Comment 10 QA Administrators 2021-12-03 04:38:31 UTC Comment hidden (obsolete)
Comment 11 Robert Großkopf 2021-12-05 14:06:17 UTC
Same buggy behavior in LO 7.2.3.2 on OpenSUSE 15.2 64bit rpm Linux.
Comment 12 QA Administrators 2023-12-06 03:18:05 UTC
Dear jimrussell98116,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug