Subject | Re: [Firebird-Architect] Extended field/domain DEFAULT usage |
---|---|
Author | Martijn Tonies |
Post date | 2006-01-05T12:51:35Z |
> >>>Any, returning to the original topic, I don't see any problems with1))"
> >>>support UDFs in default value clauses for domains. Do you?
> >>>
> >>>
> >>>
> >>What about "DEFAULT MY_UDF((SELECT VAL FROM MY_PROC), GEN_ID(MY_GEN,
> >>and alike? :-)News for you :-)
> >>
> >>
> >>
> >There is another problem related with DEFAULT and GEN_ID.
> >
> >If you have a NOT NULLable field and alter a column to have a DEFAULT
> >with GEN_ID, records stored in the previous format will evaluate the
> >DEFAULT clause in each fetch and the generator will be incremented.
> >
> >
> >
> Huh? That isn't how it works. The default value is evaluated and
> assigned during record initialization during processing of the store
> verb. It's never evaluated on fetch.
If you add a required column (not NULL) to a table with existing data,
and include a default for that column, you'll get this behaviour.
IMO, the ALTER TABLE should fail unless there are no NULLs available.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com