Subject Re: [firebird-support] There is a verb to supply identity columns?
Author hamacker
thx for Adriano.


Any possibility to be fixed in FB3 too?

2017-01-11 11:18 GMT-02:00 hamacker <sirhamacker@...>:
I knew it!
Never alone :)

I´m following your ticket, Mark.

Thanks.

2017-01-11 10:35 GMT-02:00 Mark Rotteveel mark@... [firebird-support] <firebird-support@yahoogroups. com>:
 

On 11-1-2017 12:00, hamacker sirhamacker@... [firebird-support] wrote:
> Colums identity in FB3, I love it!
>
> But there is one thing missing.
>
> I would like to know, if exists a verb to supply identity value to not
> assume a literal value. Ex:
>
> create table test (
> id integer generated by default as identity primary key,
> name varchar(15) );
>
> insert into test (id, name) values (default, 'test#1'); // default,
> any,... is there a verb to suppy identity column?

No, you currently need to do:

insert into test (name) values ('test#1');

> I know that I need to hidden fields identity, but it exists a
> possibility to keep identity fields in sql for documentation, I will
> prefer this way.
>
> If not, Ok. but I will send a ticket request. We never know, if I am
> alone in universe.

The SQL standard does have a feature like that, the <contextually typed
value specification>. I have created a ticket:
http://tracker.firebirdsql.org /browse/CORE-5449. For insert, the SQL
standard says:

"An <insert columns and source> that specifies DEFAULT VALUES is
implicitly replaced by an <insert columns and source> that specifies a
<contextually typed table value constructor> of the form VALUES
(DEFAULT, DEFAULT, ..., DEFAULT) where the number of instances of
“DEFAULT” equal to the number of columns of T."

If you follow the definition of insert (and update, merge, etc), you'll
see that DEFAULT is a contextual value similar to CURRENT_USER etc, and
means "use the default, or null if there is no default".

Mark