Subject Re: [ib-support] Create Table
Author Claudio Valderrama C.
"Helen Borrie" <helebor@...> wrote in message
news:5.1.0.14.0.20020306152057.0337c8e0@......
>
> create table test2 (
> number integer not null computed by (gen_id (gen_test, 1)),
> age integer check (age > 20),
> name varchar (20),
> constraint pk_gorilla primary key(number))
>
> or
>
> create table test2 (
> number integer computed by (gen_id (gen_test, 1)) not null,
> age integer check (age > 20),
> name varchar (20),
> constraint pk_gorilla primary key(number))
>
> (doesn't work: why? I don't know.)

column_def =>
column_def_name non_array_type def_computed
def_computed =>
computed_by '(' expression ')'
non_array_type =>
simple_type | blob_type

However, the other possible path of "colum_def" is
column_def_name data_type_or_domain default_opt column_constraint_clause
collate_clause

and the column_constraint_clause is developed finally into
column_constraint =>
NOT NULL | REFERENCES | check_constraint | UNIQUE | PK

You can compare the two cases and see that the former doesn't have a way to
reach the column_constraint_clause, hence the parser doesn't recognize it. I
think it's AS DESIGNED.

Our syntax is rigid. Either you adjust to the order shown in LangRef or your
statements aren't allowed to define a table's field:
1) The column name
2) The data type (may be the name of a domain), including charset and
sub_type, depending on the type.
3) The default
4) The constraint (not null, references, check, unique, pk).
5) The collation.

C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing