Issue 59584 - Can't access table after trying to change a field name
Summary: Can't access table after trying to change a field name
Status: CLOSED FIXED
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: OOo 2.0.1
Hardware: All All
: P2 Trivial (vote)
Target Milestone: OOo 2.0.2
Assignee: marc.neumann
QA Contact: issues@dba
URL:
Keywords: oooqa
Depends on:
Blocks:
 
Reported: 2005-12-20 09:05 UTC by sgautier.ooo
Modified: 2006-05-31 14:29 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Base file with corrupted table (2.66 KB, application/vnd.sun.xml.base)
2005-12-20 09:07 UTC, sgautier.ooo
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description sgautier.ooo 2005-12-20 09:05:36 UTC
Hi, 
Step to reproduce
. create a new database
. create a new table with only one field 'ch1', 
. add a primary key to that field
. save the table as 'table1'

. create a view of this table
. add 'table1' in the view
. add 'ch1' by double click 
. save it as 'view1'

. right click on 'table1' choose Modify
. change 'ch1' by 'ch2' and try to save it
. an error message appear : Column not found...
. close the table without saving it

. close the database file
. open it again, click on the table tab, you've got an error message and can't
access the table or the view

I'm joing the database file showing the error message :
Statut SQL: S1000
Code d'erreur: -78
error in script file line: 4 Column not found: ch1 in statement [ SELECT "ch1"
FROM "Table1" "Table1"]

Kind regards - Sophie
Comment 1 sgautier.ooo 2005-12-20 09:07:12 UTC
Created attachment 32600 [details]
Base file with corrupted table
Comment 2 alex.thurgood 2005-12-20 17:43:37 UTC
I've reset the component to Database access and set P2 coz data loss.

alex
Comment 3 alex.thurgood 2005-12-20 17:49:55 UTC
reassigning to fs
Comment 4 Frank Schönheit 2005-12-21 07:17:37 UTC
for completeness: The problem does not depend on ch1 being the primary key. If
you let OOo add another primary key automatically (upon saving the table), the
problem also occurs, you only save the error message when renaming ch1 to ch2.
Comment 5 Frank Schönheit 2005-12-21 07:37:40 UTC
targeting to 2.0.2. Sorry, 2.0 is out. 2.0.1 might be an option, but before we
do this, I want to have the decision to really block 2.0.1 for this.
Comment 6 Frank Schönheit 2005-12-21 07:38:30 UTC
fs->oj: Please work with Fred on solving this.
Comment 7 Frank Schönheit 2005-12-22 09:21:22 UTC
fs->oj: I checked in Fred's patch (in CWS dba202d). This prevents the data loss
insofar as now the column name cannot be changed anymore. However, now the table
design asks the user whether the primary key should be deleted, of which ch1 is
a part. This is somewhat strange, isn't it? Shouldn't we tell something like
"the column could not be changed, should it be deleted/re-created?"?
Comment 8 drewjensen.inbox 2006-01-02 03:21:17 UTC
Quote "This prevents the data loss
insofar as now the column name cannot be changed anymore."

Are you saying that this patch will check if the column you are about to rename
is used by a view, and if so disallow the change?

Quote "Shouldn't we tell something like
"the column could not be changed, should it be deleted/re-created?"?"

This ties in with the above question. If the column can not be renamed because
it is referenced by the view, then the user should not be able to drop it
either. In fact in 2.0.1 that is exactly the behavior, neither a column in, nor
the table itself can be dropped while the view exists.
Comment 9 ocke.janssen 2006-01-03 12:15:03 UTC
Fixed in cws dba202d
Comment 10 Frank Schönheit 2006-01-03 14:41:12 UTC
> Are you saying that this patch will check if the column you are about to rename
> is used by a view, and if so disallow the change?

Yes

> If the column can not be renamed because it is referenced by the view, then
the user
> should not be able to drop it either. In fact in 2.0.1 that is exactly the
behavior, neither
>  column in, nor the table itself can be dropped while the view exists.

The least invasive fix we can do (and only this kind of fix is acceptable for
2.0.x, for stability reasons) will continue to use the fallback to
delete/re-create columns which cannot be modified. Of course this does not make
sense in this particular case, since deletion will also fail, as you outlined.
But correctly determining this special case, and reacting appropriately, is out
of scope for 2.0.x.
Comment 11 ocke.janssen 2006-01-25 11:27:19 UTC
Please verify. Thanks.

re-open issue and reassign to msc@openoffice.org
Comment 12 ocke.janssen 2006-01-25 11:43:23 UTC
.
Comment 13 ocke.janssen 2006-01-25 11:50:38 UTC
.
Comment 14 marc.neumann 2006-01-30 13:28:46 UTC
verified in cws dba202d
Comment 15 marc.neumann 2006-02-10 09:50:46 UTC
Hi,

this is fixed in the current master. The current master is available at
http://download.openoffice.org/680/index.html

I close this issue now.

Bye Marc