Subject Re: [firebird-support] Detecting default values
Author Doug Chamberlin
On 11/3/11 2:04 PM, Tetram Corp wrote:
> How to detect if the null status I
> received in new.myfield is because the field was not in the insert
> statement or because the insert statement set it to null ?
>
> well, from
> insert into mytable (field1) values (:field1)
> or from
> insert into mytable (field1, myfield) values (:field1, null)

AFAIR, default values, as provided in the schema, are only used when the
fields are not included in the insert statement, as in your first case.
Therefore, if you set a default value that is recognizable and also use
a before insert trigger, in the trigger you can use the default value to
distinguish between the cases. The trigger can then always set the
appropriate default value and replace the dummy one fro the schema.

Try it!