[UDF] Server must prevent "return BY VALUE" for data types ISC_TIMESTAMP_TZ, ISC_TIME_TZ and so on
Firebird prohibits the creation of UDF with "return BY VALUE" for data types ISC_TIMESTAMP, ISC_QUAD based on structs but allows it for:
- FB_I128_t
- FB_DEC34_t
- FB_DEC16_t
- ISC_TIMESTAMP_TZ
- ISC_TIME_TZ
Is it an standard C ABI feature (per platform - using different compilers) return of structs by value?
Is it an standard C ABI feature (per platform - using different compilers) return of structs by value?
I don't know.
I tested FB4 with the following UDF:
DECLARE EXTERNAL FUNCTION IBP_UDF__COPY_TS_WITH_TZ
TIMESTAMP WITH TIME ZONE
RETURNS TIMESTAMP WITH TIME ZONE BY VALUE
ENTRY_POINT 'fn_copy_ts_with_tz'
MODULE_NAME 'lcpi.ibp.test.udf.01.dll';
select IBP_UDF__COPY_TS_WITH_TZ(CURRENT_TIMESTAMP) from rdb$database where 1=1
Server goes here:
https://github.com/FirebirdSQL/firebird/blob/e96217a9ca92fb30b8ab4fce6c80d625c7224208/src/jrd/fun.epp#L714-L717
and after that it returns this error:
return data type not supported; UDF: IBP_UDF__COPY_TS_WITH_TZ [SQLState:HY000, ISC error code:335544382]