Issue Details (XML | Word | Printable)

Key: CORE-3926
Type: Improvement Improvement
Status: Open Open
Priority: Trivial Trivial
Assignee: Unassigned
Reporter: Carlos H. Cantu
Votes: 0
Watchers: 5
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Inconsistent behavior with COMPUTED BY fields and metadata extraction

Created: 17/Sep/12 04:29 PM   Updated: 17/Sep/12 04:54 PM
Component/s: Engine
Affects Version/s: 2.1.0, 2.1.1, 2.0.5, 2.1.2, 2.1.3, 3.0 Initial, 2.0.6, 2.5.0, 2.1.4, 2.5.1, 2.0.7, 2.1.5, 2.5.2, 2.1.6, 2.5.3, 3.0 RC2
Fix Version/s: None


 Description  « Hide
ALTER statement allows me to change a computed by field with a new formula referencing a field that is positioned higher than the computed by field, but when you extract the table metadata and try to run it, it crashes with "Column unknown." error.

To reproduce:

Step 1)

create table a
( field2 numeric (9,2),
 field1 computed by (field2 * 0.5));

Step 2)

alter table a add field3 numeric (9,2);

Step 3)

alter table a alter field1 computed by (field3 * 0.5); -- This works fine!!!


Step 3 works fine, but when you extract the DDL of the table and try to run it, it will
crash, since it will be extracted like:

CREATE TABLE A (
    FIELD2 NUMERIC(9,2),
    FIELD1 COMPUTED BY (field3 * 0.5),
    FIELD3 NUMERIC(9,2)
);

This means that you may have a "good" database, but when you extract its metadata into a script to create another empty database, it will crash :-(

IMHO, the behavior should be consistent in the two scenarios so, or the table creation should succeed, or the ALTER should had failed.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 17/Sep/12 04:54 PM
In my opinion the alter should never fail, that would be too inflexible IMHO.