The SET BIND OF (and isc_dpb_set_bind) behaviour for NUMERIC / DECIMAL is a bit odd to me:

For example (using isc_dpb_set_bind) NUMERIC to VARCHAR will map:
- NUMERIC(n, *) where 5 <= n <= 9
- DECIMAL(n, *) where n <= 9
- INTEGER

Given the behaviour for other types, I would expect to map:
- NUMERIC(n, *) for all n (n <= 38)

The same applies to DECIMAL to VARCHAR, it will map:
- DECIMAL(n, *) where n <= 9
- NUMERIC(n, *) where 5 <= n <= 9
- INTEGER

Given the behaviour for other types, I would expect to map
- DECIMAL(n, *) for all n (n <= 38)

On the other hand NUMERIC(4) to VARCHAR will map:
- NUMERIC(n, *) where n <= 4
- SMALLINT

But DECIMAL(4) to VARCHAR will map:
- DECIMAL(n, *) where n <= 9
- NUMERIC(n, *) where 5 <= n <= 9
- INTEGER

And NUMERIC(5) to VARCHAR will map:
- NUMERIC(n, *) where 5 <= n <= 9
- DECIMAL(n, *) where n <= 9
- INTEGER

And both NUMERIC(n) to VARCHAR and DECIMAL(n) to VARCHAR with 10 <= n <= 18 map:
- NUMERIC(n, *) where 10 <= n <= 18
- DECIMAL(n, *) where 10 <= n <= 18
- BIGINT

And both NUMERIC(n) to VARCHAR and DECIMAL(n) to VARCHAR with 19 <= n <= 38 map:
- NUMERIC(n, *) where 19 <= n <= 38
- DECIMAL(n, *) where 19 <= n <= 38

In other words, it looks like the mapping:

1. ignores subtype information and
2. does not handle precision-less as covering all values, but instead selects the INTEGER-backed types

--
Mark Rotteveel


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to