Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when altering numeric domain or table field [CORE1916] #2349

Closed
firebird-automations opened this issue May 27, 2008 · 6 comments
Closed

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Miroslav Djorov (miro)

/*this script works on Firebird 2.0.3, but on 2.1.0 give errors*/

CREATE DOMAIN DOM_TEST NUMERIC (8,3);
/*ok*/

ALTER DOMAIN DOM_TEST TYPE NUMERIC (8,4);
/*
This operation is not defined for system tables.
unsuccessful metadata update.
New scale specified for column DOM_TEST must be at most 3.
*/

ALTER DOMAIN DOM_TEST TYPE NUMERIC(8,2);
/*ok*/

ALTER DOMAIN DOM_TEST TYPE NUMERIC(8,3);
/*This operation is not defined for system tables.
unsuccessful metadata update.
New scale specified for column DOM_TEST must be at most 2.
*/

CREATE TABLE TEST (A NUMERIC (8,4));

ALTER TABLE TEST ALTER A TYPE NUMERIC (8,3);
/*ok*/

ALTER TABLE TEST ALTER A TYPE NUMERIC (8,4);
/*
This operation is not defined for system tables.
unsuccessful metadata update.
New scale specified for column A must be at most 3.
*/

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

This is "as designed". You are not allowed to use ALTER to decrease the maximum possible value stored. A switch from NUMERIC(8, 3) to NUMERIC(8, 4) reduces the integral part of the value from 5 to 4 decimal digits and existing values may not satisfy the new definition. The same rule applies to strings: you can extend the field but cannot truncate it. So, actually, it was a bug in v2.0 which has been fixed in v2.1.

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Ain Valtin (ain)

Dimitry, it would make sense to allow to ALTER the domain when existind data comply with the new definition... sure would make life easier for users.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Maybe. But it should be a separate feature request.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: FireBird User (firebirduser)

It causes so much trouble for not having this feature on FireBird, what is your suggestion to solve this issue without dropping the table and re-create because table has dependencies and I need to drop all the dependencies just to increase a decimal scale?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant