Bug 53591 - EDITING: Table Design: changing column type does not reset length to default value
Summary: EDITING: Table Design: changing column type does not reset length to default ...
Status: CLOSED DUPLICATE of bug 49054
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
3.4.4 release
Hardware: Other All
: medium normal
Assignee: Lionel Elie Mamane
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-16 14:21 UTC by Dan Lewis
Modified: 2012-08-27 19:10 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Lewis 2012-08-16 14:21:39 UTC
Problem description: 
     When selecting the Text [VARCHAR] , the Length property varies depending upon what field type has been selected before it. If the the previous selection was Yes/No [BOOLEAN], the Length is 1. If the previous selection was Binary [BINARY], the Length is 2147483647. But when a new field is created, Change the Field Type to Text [VARCHAR] and observe the Length in the Field Properties. But if a new field is created, Text [VARCHAR] is the selected Field Type and the Length is 100.
     The same situation seems to be true for Text [CHAR]

Steps to reproduce:
1. Open the Table Design dialog.
2. Enter a field name.
3. Enter the Field Type as Yes/No [BOOLEAN]
4. Change the Field Type to Text [VARCHAR] and observe the Length in   
   the Field Properties.
5. Change the Field Type to Binary [BINARY] and observe the Length in
   the Field Properties.
6. Change the Field Type to Text [VARCHAR] and observe the Length in   
   the Field Properties.
Current behavior: When changing a Field Type to Text [VARCHAR] or Text [CHAR], the Length property does not change from what it was before.

Expected behavior: When selecting Text [VARCHAR] or Text [CHAR] as the Field Type, the Length should be 100 in the Field Properties.

Platform (if different from the browser): 
              
Browser: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120715 SeaMonkey/2.11
Comment 1 Alex Thurgood 2012-08-19 10:59:15 UTC
I can reproduce this behaviour on Linux Mint 64 bit with :


LibreOffice 3.4.4 
OOO340m1 (Build:402)

Changing version to earliest version known to display buggy behaviour and confirming.


@Lionel : assigning to you, if you have time to take a look, otherwise reassign to default.

Alex
Comment 2 Alex Thurgood 2012-08-19 11:05:51 UTC
And also reproducible in Version 3.6.0.4 (Build ID: 932b512)


Alex
Comment 3 Alex Thurgood 2012-08-19 11:08:52 UTC
Although I haven't tested, I'm assuming that if a user was not paying attention and saved the table as he/she had designed it with the buggy behaviour defaults, then any attempt to enter data subsequently, which was greater than the length of the assigned default length would truncate or fail ?


Alex
Comment 4 Alex Thurgood 2012-08-19 11:14:32 UTC
Yep, the following error message :

SQL Status: 22001
Error code: -124

Value too long in statement [INSERT INTO "Table1" ( "active","ctry","top","txt") VALUES ( ?,?,?,?)]

The final field "txt" was defined first as BOOLEAN, then I used the dropdown list to change it to VARCHAR and saved the table. Opened table in data entry mode, and started typing, using tab to switch between fields. The error message is produced when I try to tab out of the tuple and into the next new one. So at least there is some kind of warning for the user at the data entry level.

Alex
Comment 5 Alex Thurgood 2012-08-19 11:19:22 UTC
Oooh, this behaviour has just caused me to notice an unwanted side effect that IMO is a bug :

Each failed insert causes the autoincrement index to update itself such that when the record is finally successfully written, the index with the latest increment gets written to the table. Failed inserts should not update the autoincrement counter. I'll file a separate issue for that.


Alex
Comment 6 Lionel Elie Mamane 2012-08-19 16:53:19 UTC
I'm not 100% convinced that we should always reset the length to its (type-specific) default value. Not even sure we should *ever* do it. After all, the data that is already in these columns is type-converted, and the length specifier tells us how long it needs to be! For example:

 - change from VARCHAR to CHAR or vice-versa:
   these are similar datatypes, the length should be kept always.

 - change from FLOAT/NUMERIC/INTEGER to (VAR)CHAR:
   the number will be changed to a decimal representation,
   and the length specifier tells us the maximal length
   the result will have.
Comment 7 Dan Lewis 2012-08-20 17:36:42 UTC
I'm not sure I completely agree with you. However, this is a small issue since a person is suppose to know what length each field should be before creating the database. There is another another bug I plan to file this afternoon that needs much more attention than this does (LO 3.6.0.4 corrupts the Base database document file).
Comment 8 Alex Thurgood 2012-08-27 19:06:43 UTC

*** This bug has been marked as a duplicate of bug 49054 ***