Issue Details (XML | Word | Printable)

Key: CORE-1162
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Claudio Valderrama C.
Reporter: prenosil
Votes: 1
Watchers: 0
Operations

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

Problem altering numeric field type

Created: 08/Mar/07 12:28 PM   Updated: 02/Jul/07 03:21 AM
Component/s: Engine
Affects Version/s: 2.0.0
Fix Version/s: 2.1 Beta 1

Time Tracking:
Not Specified

Issue Links:
Relate
 


 Description  « Hide
create table tab ( a numeric(4,2) );

insert into tab values (99.99);

select * from tab;

      A
=======
  99.99

alter table tab alter a type numeric(4,3);

select * from tab;

Statement failed, SQLCODE = -802
arithmetic exception, numeric overflow, or string truncation

Btw. the database is not "corrupted" too badly - you can revert the change back by alter table tab alter a type numeric(4,2);
and the engine is clever enough to convert data from stored format to requested one directly, not through all intermediate format versions.


 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Claudio Valderrama C. added a comment - 15/Mar/07 10:07 AM
Again, dyn_mod.epp. This time, check_update_fld_type().

Philippe Makowski added a comment - 27/Jun/07 04:00 AM
Q/A test in 2.0.1 ok
test file made

Philippe Makowski added a comment - 28/Jun/07 04:39 AM - edited
Here what I get under FB-SS-Win32-2.0.1.12855 :
Statement failed, SQLCODE = -802
      arithmetic exception, numeric overflow, or string truncation

And here what I get under FB-SS-Win32-2.1.0.15999 :

      Statement failed, SQLCODE = -607
      unsuccessful metadata update
      -New scale specified for column A must be at most 2.


details :

SQL> create table tab ( a numeric(4,2) );
SQL> insert into tab values (99.99);
SQL> alter table tab alter a type numeric(4,3);
Statement failed, SQLCODE = -607
unsuccessful metadata update
-New scale specified for column A must be at most 2.
SQL> select * from tab;

      A
=======
  99.99

SQL> commit;
SQL> show table tab;
A NUMERIC(4, 2) Nullable
SQL>

Philippe Makowski added a comment - 02/Jul/07 03:21 AM
Closed and test ok and made for 2.1