On Fri, 30 Aug 2013 16:28:37 +0200, "Robbert-Jan"
<rjm_eabonnem...@xs4all.nl> wrote:
> Hi,
> 
> I like to propose a more consistent syntax for computed columns and
> identity columns:
> 
> Computed columns are now defined in DDL as
> 
> <ColumnName> [<DataType>] GENERATED ALWAYS AS (<Expression>)
> 
> while identity columns (as of FB 3.0 CORE-1385) are defined as:
> 
> <ColumnName> {<DataType>|<DomainName>} GENERATED {ALWAYS|BY DEFAULT} AS
> IDENITITY
> 
> Note the differences:
> - for computed columns the datatype is optional (if ommitted the system
> will find an appropriate datatype)
> - identity columns can be defined as both datatype and domain, where
> computed columns can only be defined as datatype
> - identity columns can be defined as both ALWAYS (although not yet
> implemented) and BY DEFAULT, while computed columns can only be defined
as
> ALWAYS
> 
> To make this more consistent, I like to propose to:
> - also support domains for computed columns;
> - also make the specification of datatype/domain for identity columns
> optional (if it is ommitted the system should assume INTEGER);
> - also support GENERATED BY DEFAULT for computed columns.
> 
> 
> The syntax will then also be more generic (covering both computed and
> identity columns):
> 
> generated column specification ::= <ColumnName>
> [{<DataType>|<DomainName>}] GENERATED {ALWAYS|BY DEFAULT} AS
> {(<Expression>)|IDENTITY} 

I am not entirely sure what the SQL Specification says as I don't have it
handy right now, but the current syntax is derived from the specification. 
I also am not sure if a GENERATED BY DEFAULT AS ... makes sense for a
computed column, as it would imply it is a normal column that has a default
(which already has a separate clause) and not a computed one.

Mark

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to