Subject | Expressions in DEFAULT |
---|---|
Author | Adriano dos Santos Fernandes |
Post date | 2005-04-23T20:08:49Z |
Hi!
A question has come to my mind: Why DEFAULT don't accept expressions?
Usage example:
create generator g;
create table t (n1 integer, n2 integer default (gen_id(g, 1)));
With a little change in the parser the thing start to work, with one
problem:
insert into t (n1, n2) values (0, 0);
insert into t (n1) values (1);
The value of "n2" in the second record is 2, instead of 1.
Problem is caused in make_defaults (jrd/cmp.cpp) and maybe is not
difficult to fix.
Do someone see any problem, except open other can of worms to Sean? :-)
Adriano
A question has come to my mind: Why DEFAULT don't accept expressions?
Usage example:
create generator g;
create table t (n1 integer, n2 integer default (gen_id(g, 1)));
With a little change in the parser the thing start to work, with one
problem:
insert into t (n1, n2) values (0, 0);
insert into t (n1) values (1);
The value of "n2" in the second record is 2, instead of 1.
Problem is caused in make_defaults (jrd/cmp.cpp) and maybe is not
difficult to fix.
Do someone see any problem, except open other can of worms to Sean? :-)
Adriano