Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 16 total
Thread GENERATED vs. COMPUTED
Mon, Mar 19 2007 7:59 AMPermanent Link

Michael Baytalsky
Tim,

I have noticed, that you changed GENERATED keyword to
COMPUTED, which is very nice, cause it's less confusing.

However, I read this in the documentation:
----------------
[GENERATED <GenerationOptions>|COMPUTED <ComputationOptions>|

<GenerationOptions> =
ALWAYS AS <GenerateExpression>|
ALWAYS AS IDENTITY (START WITH <SeedValue>, INCREMENT BY <IncrementValue>)|
BY DEFAULT AS IDENTITY (START WITH <SeedValue>, INCREMENT BY <IncrementValue>)

<ComputationOptions> =
ALWAYS AS <ComputeExpression>
----------------
What confuses me here is
<GenerationOptions> = ALWAYS AS <GenerateExpression>|

What does it suppose to be - an equivalent of COMPUTED or something
entirely different?

I'm working on updating our database designer profile to reflect these
changes, so I wonder what GenerateExpression is - is it the same as
DefaultExpression or is it the same as ComputeExpression or is it just
a typo in the help file?

Regards,
Michael
Mon, Mar 19 2007 8:07 AMPermanent Link

Michael Baytalsky
Tim,

One more thing. In COMPUTED ALWAYS AS <expression> the word ALWAYS seem
to be rudimentary, cause it doesn't really mean anything - or so it seems.
The keyword AS is also usually marked as optional in other engines.


Regards,
Michael



Michael Baytalsky wrote:
> Tim,
>
> I have noticed, that you changed GENERATED keyword to
> COMPUTED, which is very nice, cause it's less confusing.
>
> However, I read this in the documentation:
> ----------------
> [GENERATED <GenerationOptions>|COMPUTED <ComputationOptions>|
>
> <GenerationOptions> =
> ALWAYS AS <GenerateExpression>|
> ALWAYS AS IDENTITY (START WITH <SeedValue>, INCREMENT BY <IncrementValue>)|
> BY DEFAULT AS IDENTITY (START WITH <SeedValue>, INCREMENT BY
> <IncrementValue>)
>
> <ComputationOptions> =
> ALWAYS AS <ComputeExpression>
> ----------------
> What confuses me here is
> <GenerationOptions> = ALWAYS AS <GenerateExpression>|
>
> What does it suppose to be - an equivalent of COMPUTED or something
> entirely different?
>
> I'm working on updating our database designer profile to reflect these
> changes, so I wonder what GenerateExpression is - is it the same as
> DefaultExpression or is it the same as ComputeExpression or is it just
> a typo in the help file?
>
> Regards,
> Michael
Mon, Mar 19 2007 9:26 AMPermanent Link

"Ole Willy Tuv"
Michael,

<< What confuses me here is
<GenerationOptions> = ALWAYS AS <GenerateExpression> >>

I think Tim implemented the generation clause according to the SQL:2003
syntax:

GENERATED ALWAYS AS <generation expression>

and then added support for using the COMPUTED keyword as an alternative to
GENERATED in v1.01, hence they mean the same thing.

Ole Willy Tuv

Mon, Mar 19 2007 9:30 AMPermanent Link

"Ole Willy Tuv"
Michael,

<< The keyword AS is also usually marked as optional in other engines. >>

Depends on the context, I guess. In this case I personally think an explicit
AS makes sense.

Ole Willy Tuv

Mon, Mar 19 2007 10:24 AMPermanent Link

Michael Baytalsky
Ole,

> I think Tim implemented the generation clause according to the SQL:2003
> syntax:
> GENERATED ALWAYS AS <generation expression>
> and then added support for using the COMPUTED keyword as an alternative to
> GENERATED in v1.01, hence they mean the same thing.
I don't want to speculate here, however, they are stored separately in
the information schema table, so they may have separate meaning also.
E.g. I can see how generated always/by default can mean, e.g. NEW GUID, while
computed - just a run-time calculation. Although, I fail to understand
why anyone would want to have GUID that is always being generated and
how GENERATED BY DEFAULT is any different from DEFAULT expression...

Therefore, I'd leave it to the master to explain Wink


Michael
Mon, Mar 19 2007 10:30 AMPermanent Link

Michael Baytalsky
Ole,

> << The keyword AS is also usually marked as optional in other engines. >>
> Depends on the context, I guess. In this case I personally think an explicit
> AS makes sense.
Actually, I think I was wrong. Interbase has COMPUTED [BY] syntax, whereas
MS SQL has AS (expression) syntax.... No wonder they mixed up in my head...

I have no opinion as to which syntax should be preferred here
and why there seem to be no standard for such simple thing... ;-/

Cheers,
Michael
Mon, Mar 19 2007 10:48 AMPermanent Link

"Ole Willy Tuv"
Michael,

<< I have no opinion as to which syntax should be preferred here and why
there seem to be no standard for such simple thing... ;-/ >>

There is a standard syntax for this:

GENERATED ALWAYS AS <generation expression>

Ole Willy Tuv

Mon, Mar 19 2007 10:55 AMPermanent Link

"Ole Willy Tuv"
Michael,

<< ... and how GENERATED BY DEFAULT is any different from DEFAULT
expression... >>

GENERATED BY DEFAULT is one of the options in the standard syntax for the
identity specification, and is not available in the plain generation clause.

<< Therefore, I'd leave it to the master to explain Wink >>

Right Smile

Ole Willy Tuv

Mon, Mar 19 2007 1:40 PMPermanent Link

Michael Baytalsky

> There is a standard syntax for this:
> GENERATED ALWAYS AS <generation expression>
.... and which database engine adheres to this standard?



Michael
Mon, Mar 19 2007 2:10 PMPermanent Link

"Ole Willy Tuv"
Michael,

<< ... and which database engine adheres to this standard? >>

ElevateDB Smile

Ole Willy Tuv

Page 1 of 2Next Page »
Jump to Page:  1 2
Image