On 16-9-2019 12:50, Alex Peshkoff via Firebird-devel wrote:
In FB4 there was added a number of new datatypes (and will be added
128-bit integers). For all of them separate SET statement is added to
make it possible to bind them with some old, well known to old clients
datatype. Also DPB item is added to control initial state of this feature.
It was very good (but left unnoticed suggestion) from Dimitry
Sibiryakov: add single SQL statement to tune automatic datatypes
coercion. I agree with this suggestion and suggest to drop all 'set
bind' statements, all related DPB items and add instead single statement
with such syntax:
ALTER SESSION DESCRIBE type1 AS type2
and single DPB item (may be repeated multiple times) to control how
server types are described to client.
The key specific of type1 and type2 used in it is that:
- when some type specifier (precision, charset, etc.) is not provided
explicitly in TYPE1 rule is used for any specifier value.
Example - ALTER SESSION DESCRIBE DECFLOAT AS ... applies
to both decfloat(16) & decfloat(34).
- when some type specifier is not provided explicitly in TYPE2 server
should provide some 'good' value depending upon TYPE1
Example - after ALTER SESSION DESCRIBE DECFLOAT AS CHAR
char() wll be used for decfloat(16) and char() for decfloat(34).
I like the idea, but I don't like the use of `ALTER SESSION`. The SQL
standard way of managing session configuration is `SET` (see chapter 19
Session management of SQL:2016-2). Lets not introduce a different
syntax, and follow the standard in this and use `SET` as well, just like
Firebird has done historically (eg SET NAMES in ISQL) and has been done
in other recent changes (eg SET ROLE, SET TIME ZONE).
Technically, you could just as well still use `SET <type> BIND [AS]
<target_type>` (although grammar-wise it might potentially be an issue).
You don't need to reorder things here just to make it a single DPB item.
But if we reorder things, maybe
`SET BIND OF <type> {AS|TO} <target_type>`
We may need to consider changing `ALTER SESSION RESET` to `RESET
SESSION` or `SET SESSION RESET` or something to get rid of `ALTER
SESSION` entirely.
Mark
--
Mark Rotteveel
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel