8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 20:43:02 +01:00

1) Allow to reference others fields in the expression of ALTER...COMPUTED

2) Documentation
This commit is contained in:
asfernandes 2008-05-11 20:05:12 +00:00
parent 86b80853bf
commit 7d34ead84e
2 changed files with 25 additions and 0 deletions

View File

@ -187,3 +187,21 @@ executed to go from input type X to output type Z. If you have such problem in
databases created with earlier versions and you have a backup for them that want
to restore in FB2, expect to see your database restore being rejected by FB2.
7) ALTER computed fields
(Adriano dos Santos Fernandes)
Syntax:
alter table ...
alter <field> [type <data type>] computed by (<expression>);
Notes:
- You cannot alter a non-COMPUTED field to COMPUTED and vice-versa.
Example:
create table test (
n integer,
dn computed by (n * 2)
);
alter table test
alter dn computed by (n + n);

View File

@ -6715,6 +6715,11 @@ static void modify_field(dsql_req* request,
dsql_nod* computedNod = element->nod_arg[e_mod_fld_type_computed];
if (computedNod)
{
if (request->req_context_number)
reset_context_stack(request);
PASS1_make_context(request, request->req_ddl_node->nod_arg[e_alt_name]);
dsql_str* computedSrc = (dsql_str*) computedNod->nod_arg[e_cmp_text];
fb_assert(computedSrc->str_length <= MAX_USHORT);
@ -6733,6 +6738,8 @@ static void modify_field(dsql_req* request,
request->append_string(isc_dyn_fld_computed_source,
computedSrc->str_data, (USHORT) computedSrc->str_length);
reset_context_stack(request);
}
const dsql_nod* defNod = element->nod_arg[e_mod_fld_type_default];