Subject Re: [firebird-support] FB 2.1 and ALTER DOMAIN
Author Fidel Viegas
On Tue, May 6, 2008 at 3:00 PM, Luis Madaleno | magnisoftR
<madaleno@...> wrote:
> Hi,
>
> I have this domain:
>
> CREATE DOMAIN PERCENTAGENS AS NUMERIC(10,2) DEFAULT 0;
>
> Till FB 2.0.3 I could change the domain type with this command:

There was a discussion about this before, and as far as I can remember
this was a bug in FB 2.0.3, and has been fixed in FB 2.1

> ALTER DOMAIN PERCENTAGENS TYPE NUMERIC(10,4);
>
> But in FB 2.1 this fails with the message:
>
> This operation is not defined for system tables.
>
> unsuccessful metadata update.
>
> New scale specified for column PERCENTAGENS must be at most 2.

Exactly, you can not redefine a domain with a scale higher than the
one you have first defined. You declared your domain with a scale of 2
initially, and now you are trying to define it with a scale of 4. That
is not permitted in FB 2.1.


> Is there a way to achieve this in FB 2.1?

Maybe someone has a better suggestion, but I think that you have to
drop the domain and recreate it again. But remember that you will be
able to do that only if your domain doesn't have any dependencies. If
it does have dependencies, then you will have to drop all the
dependencies first and then create the new domain.

Fidel.