Subject RE: [IBDI] Re: DEFAULT Values
Author Dmitry Yemanov
Hi Ann,

> Ahh!!! Now I understand. If you defined the constraint on the column
> definition, it was stored in RDB$RELATION_FIELDS even if a dummy
> domain was created. OK. Here's what you can do - though
> it's not lovely.
> First, update the domain. Then, force the update through to
> the fields.
>
> update rdb$relation_fields
> set rdb$default_value =
> (select rdb$default_value
> from rdb$fields f
> where f.rdb$field_name =
> b$relation_fields.rdb$field_source)
> where rdb$field_name = <my column>
> and rdb$relation_name = <my table>;
>
> update rdb$relation_fields
> set rdb$default_source =
> (select rdb$default_source
> from rdb$fields f
> where f.rdb$field_name =
> rdb$relation_fields.rdb$field_source)
> where rdb$field_name = <my column>
> and rdb$relation_name = <my table>;

Yeah, this is exactly what I meant and what I was looking for. Thank you,
Ann.

Finally, to turn the issue out of the support area, should we consider it a
disadvantage of the current implementation? IMHO, the goal of the above
direct metadata updates may be achieved with the appropriate DDL statement.
I'm talking about ALTER TABLE <table_name> ALTER [COLUMN] <column_name>
SET/DROP DEFAULT [<value>]. Would't it be useful?

Just a proposal.

Cheers,
Dmitry