Bug 147657 - Default value of a table won't be saved right when formatted other than YYYY-MM-DD
Summary: Default value of a table won't be saved right when formatted other than YYYY-...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.1.8.1 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Tables
  Show dependency treegraph
 
Reported: 2022-02-25 18:01 UTC by jcsanz
Modified: 2022-11-15 08:24 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Firebird embedded test database (2.85 KB, application/vnd.sun.xml.base)
2022-02-25 18:01 UTC, jcsanz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jcsanz 2022-02-25 18:01:22 UTC
Created attachment 178542 [details]
Firebird embedded test database

In the table designer, when you create a date field and assign it a default value, the assigned value is modified depending on the actions you do in the designer. For example, if you select another field and return again to the date field, the value assigned by default has been modified, it is also modified if you save the table but do not close the table designer and also when you close the designer.

In addition, the value that is inserted in the table when adding a record is *completely different* from the value that remained in the designer when it was closed.

Steps to reproduce:
    1. Create or open a database
    2. Create a new table
    3. In the new table, create a field called ID, type INTEGER and AutoValue (primary key).
    4. Create a new field called e.g. Fecha of type DATE and set a default date, for example 01/01/2022. Change the format fiel to date DD/MM/AAAA 
    5. Select the ID field
    6. Select the Date field again, the default date will have changed to 03/01/2021 (or another value different from the original one).
    7. Click on the Save icon, the date in the default value field will change again with each click.
    8. Save the table and assign a name to it, close the designer and open the table to enter data.
    9. Insert a record to see the date that is assigned by default, it will be a completely different date from the one assigned by default in the table designer (in my case, the last value in the designer was 09/01/2021 and the date assigned by default was 02/01/0009).

Expected:
    1. That the default date value is not modified whatever action is done in the table designer.
    2. That once the table is designed, when inserting records, the default value assigned when designing the table is automatically entered in the date field.

Tested with:
- Firebird embedded
- HSQLDB embedded
- MariaDB 10.6 Direct connection
on :Version: 7.3.0.3 (x64) / LibreOffice Community
Build ID: 0f246aa12d0eee4a0f7adcefbf7c878fc2238db3
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL

And tested with:
-HSQLDB emnbedded 
on:
Version: 7.1.7.2 / LibreOffice Community
Build ID: 10(Build:2)
CPU threads: 2; OS: Linux 5.11; UI render: default; VCL: kf5
Locale: es-ES (es_ES.UTF-8); UI: es-ES
Ubuntu package version: 1:7.1.7-0ubuntu0.21.04.1
Calc: threaded
Comment 1 Robert Großkopf 2022-02-26 10:28:53 UTC
Parts of this are a duplicate of Bug 102945. Jumping to days in the future every time when switching from date field in table design to another field is reported.

Please don't mix different buggy behavior in one bug. 

I changed this bug to the totally wrong value, which is shown in the table when input new values.

You could get the "right" values if you change the format of the date in table design to YYYY-MM-DD. See https://bugs.documentfoundation.org/show_bug.cgi?id=102945#c0

Then you have to switch back the format when table is saved and you will try to input new data. 

The buggy behavior with total different default values when editing a table and opening the table for input data in other formats than YYYY-MM-DD I could confirm with LO 7.3.1.1 on OpenSUSE 15.3 64bit rpm Linux.