FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.22k stars 213 forks source link

Charset of TS_WITH_TZ (and etc) text presentation is NONE. It is expected UTF8 #7704

Open dmitry-lipetsk opened 11 months ago

dmitry-lipetsk commented 11 months ago

Firebird - WI-V4.0.3.2973

RDB$TIME_ZONES::RDB$TIME_ZONE_NAME says that time zone name can be UTF8.

So, I think, the text presentation of TIMESTAMP WITH TIME ZONE value must have UTF8 charset, too.

The following test shows that the presentation of this type and the presentation of other types have the NONE charset.

d:\Program_Files\Firebird_4_0_x64>isql.exe
Use CONNECT or CREATE DATABASE to specify a database
SQL> connect 'inet4://localhost/d:\Database\FB_04_0_0\IBP_TEST_FB40_D3.GDB' user 'SYSDBA' password 'masterkey';
Database: 'inet4://localhost/d:\Database\FB_04_0_0\IBP_TEST_FB40_D3.GDB', User: SYSDBA

SQL> show version;

ISQL Version: WI-V4.0.3.2973 Firebird 4.0
Server version:
Firebird/Windows/AMD/Intel/x64 (access method), version "WI-V4.0.3.2973 Firebird 4.0"
Firebird/Windows/AMD/Intel/x64 (remote server), version "WI-V4.0.3.2973 Firebird 4.0/tcp (HOME4)/P17:C"
Firebird/Windows/AMD/Intel/x64 (remote interface), version "WI-V4.0.3.2973 Firebird 4.0/tcp (HOME4)/P17:C"
on disk structure version 13.0SQL> SET SQLDA_DISPLAY ON;

SQL> select _none ''||_utf8 '' from rdb$database;

INPUT message field count: 0

OUTPUT message field count: 1
01: sqltype: 448 VARYING scale: 0 subtype: 0 len: 0 charset: 4 UTF8
  :  name: CONCATENATION  alias: CONCATENATION
  : table:   owner:

CONCATENATION
=============

SQL> select _none ''||timestamp '2023-09-10 08:33:01.4321' from rdb$database;

INPUT message field count: 0

OUTPUT message field count: 1
01: sqltype: 448 VARYING scale: 0 subtype: 0 len: 25 charset: 0 NONE
  :  name: CONCATENATION  alias: CONCATENATION
  : table:   owner:

CONCATENATION
=========================
2023-09-10 08:33:01.4321

SQL> select _none ''||timestamp '2023-09-10 08:33:01.4321 Europe/Moscow' from rdb$database;

INPUT message field count: 0

OUTPUT message field count: 1
01: sqltype: 448 VARYING scale: 0 subtype: 0 len: 57 charset: 0 NONE
  :  name: CONCATENATION  alias: CONCATENATION
  : table:   owner:

CONCATENATION
=========================================================
2023-09-10 08:33:01.4321 Europe/Moscow

SQL> select _none ''||123.321E+4 from rdb$database;

INPUT message field count: 0

OUTPUT message field count: 1
01: sqltype: 448 VARYING scale: 0 subtype: 0 len: 24 charset: 0 NONE
  :  name: CONCATENATION  alias: CONCATENATION
  : table:   owner:

CONCATENATION
========================
1233210.000000000

SQL> select _none ''||123.321E+77 from rdb$database;

INPUT message field count: 0

OUTPUT message field count: 1
01: sqltype: 448 VARYING scale: 0 subtype: 0 len: 24 charset: 0 NONE
  :  name: CONCATENATION  alias: CONCATENATION
  : table:   owner:

CONCATENATION
========================
1.233210000000000e+79
mrotteveel commented 11 months ago

I do wonder: as far as I'm aware, all time zones names are basic ASCII. Why are we using UTF8 for this?