On 19/01/2017 07:07, Mark Rotteveel wrote:
> On 2017-01-18 23:38, Adriano dos Santos Fernandes wrote:
>> Ann, I assigned it to me based on Dimitry S. comment.
>>
>> After your comment, I edited the case to reflect the standard.
> Does the standard actually allow having an insert with null (or any 
> other value for that matter) for a GENERATED ALWAYS AS IDENTITY (I don't 
> have a copy of the SQL standard at hand right now)? I would expected an 
> error to be raised; as far as I am aware, that is only supported with 
> DEFAULT (see CORE-5449).
>
>
<insert statement>

7) If the <insert column list> is omitted, then an <insert column list>
that identifies all columns of T in the
ascending sequence of their ordinal positions within T is implicit.

(I understand that if column list is omitted, values for identity
columns "generated always" should be given by the user - see clause 10)

10) If <contextually typed table value constructor> CTTVC is specified,
then every <contextually typed row
value constructor element> simply contained in CTTVC whose positionally
corresponding <column name>
in <insert column list> references

(I understand that GENERATED ALWAYS column, if implicit by empty field
list, or explicit, should be passed with DEFAULT - but see clause 11.b)

11) Case:

b) If for some n, some underlying column of the column referenced by the
<column name> CN contained
in the n-th ordinal position in <insert column list> is an identity
column, system-time period start
column, or system-time period end column whose descriptor includes an
indication that values are
always generated, then

ii) If any <contextually typed row value expression> simply contained in
the <contextually typed
table value constructor> is a <row value special case>, then <override
clause> shall be specified.

i) If <from subquery> is specified, then <override clause> shall be
specified.

(I understand that even GENERATED ALWAYS can be overriden if <override
clause> is used with)

NOTE 516 — The preceding subrule does not cover all possibilities. The
remaining possibilities are where <default
specification> is specified for every identity column, or for a
system-time period start column or system-time period
end column, in which case it is immaterial whether <override clause> is
specified or not.

(???)

c) If for some n, some underlying column of the column referenced by the
<column name> CN contained
in the n-th ordinal position in <insert column list> is an identity
column whose descriptor includes an
indication that values are generated by default, then if <override
clause> is specified, then <override
clause> shall specify OVERRIDING USER VALUE.

(Seems our GENERATED BY DEFAULT is compliant)

...

e) Otherwise, <override clause> shall not be specified.


Adriano


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to