On 28/02/2026 10:31, 'Dimitry Sibiryakov' via firebird-devel wrote:
> 'Mark Rotteveel' via firebird-devel wrote 28.02.2026 9:32:
>>>
>>> Question 1: how to get default value for procedure parameter to be
>>> stored in RDB$FIELDS?
>>
>>
>> The default of a parameter should never be stored in RDB$FIELDS. It is
>> where the default of a domain is stored.
>
> Yes, but if parameter is declared with type only, RDB$XXX domain is
> created for it automatically because RDB$PROCEDURE_PARAMETERS has no
> capacity to keep a data type.
When defining a column or parameter with an explicit default, it's never
stored in RDB$FIELDS.
>>> Question 2: shouldn't procedure parameters implicitly inherit
>>> default value from domain or field they are based on?
>>
>> Maybe I'm missing something, but isn't that _why_ it *reads* from
>> RDB$FIELDS?
>
> Yes, it looks so from code, but following script fails:
>
> create domain t_dom_default varchar(20) default 'Domain default';
> create procedure t_proc (a varchar(20) default 'Parameter default', b
> t_dom_default) as begin end;
>
> That's the question.
I think this might indicate that the change of
https://github.com/FirebirdSQL/firebird/issues/7566 (which I just
happened to look at today) is not complete, because before that, the
default was never obtained from the domain for procedures or functions,
only the one explicitly specified.
To be honest, I'm not even sure if the change mentioned in the comments
to use the domain default also applies for implicit defaults, or only
when passing explicit DEFAULT when calling the stored procedure or function.
Mark
PS It would be helpful to quote the error message when saying something
failed, in this case, the error is "can not define a not null column
with NULL as default value; invalid clause --- 'defaults must be last'"
--
Mark Rotteveel