FirebirdSQL / firebird

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

Number of digits in exponent of cast( <double> to varchar ) in dialect 1 depends on protocol that is used for connecting to database [CORE4814] #5112

Open firebird-automations opened 9 years ago

firebird-automations commented 9 years ago

Submitted by: @pavel-zotov

WI-T3.0.0.31844

C:\MIX\firebird\QA\fbt-repo\tmp>isql -q SQL> set sql dialect 1; SQL> create database 'c:\temp\c1712dia1_emb.fdb'; SQL> select cast(1e19 as varchar(30)) from rdb$database;

CAST

1.000000000000000e+19

SQL> exit;

C:\MIX\firebird\QA\fbt-repo\tmp>isql -q SQL> set sql dialect 1; SQL> create database 'localhost/3333:c:\temp\c1712dia1_tcp.fdb'; SQL> select cast(1e19 as varchar(30)) from rdb$database;

CAST

1.000000000000000e+019

Note that when TCP is used than exponent is '+019' -- with leading '0' left side from '19'. The same will be if we use existent database instead of creating it.

firebird-automations commented 9 years ago

Commented by: @dyemanov

Please test prior version(s) and specify whether it's a regression or not.

firebird-automations commented 9 years ago

Commented by: @pavel-zotov

On WI-V2.1.7.18553 and WI-V2.5.5.26907 both cases produce exponent with three digits (i.e. with leading zero), regardless to used protocol:

C:\1INSTALL\FIREBIRD\fb25sC\bin>.\isql -q SQL> set sql dialect 1; SQL> create database 'c:\temp\tmp25_d1_local.fdb'; SQL> select cast(1e19 as varchar(30)) from rdb$database;

CAST

1.000000000000000e+019

SQL> quit;

C:\1INSTALL\FIREBIRD\fb25sC\bin>.\isql -q SQL> set sql dialect 1; SQL> create database 'localhost/3255:c:\temp\tmp25_d1_remote.fdb'; SQL> select cast(1e19 as varchar(30)) from rdb$database;

CAST

1.000000000000000e+019

SQL> show version; ISQL Version: WI-V2.5.5.26907 Firebird 2.5 Server version: Firebird/x86/Windows NT (access method), version "WI-V2.5.5.26907 Firebird 2.5" Firebird/x86/Windows NT (remote server), version "WI-V2.5.5.26907 Firebird 2.5/tcp (balaha)/P12" Firebird/x86/Windows NT (remote interface), version "WI-V2.5.5.26907 Firebird 2.5/tcp (balaha)/P12" on disk structure version 11.2 SQL>

firebird-automations commented 9 years ago

Commented by: @dyemanov

v2.х uses the XNET protocol in this case, not embedded like v3. You may try running fb_inet_server with the -i switch to disable XNET and check again.

firebird-automations commented 9 years ago

Commented by: @pavel-zotov

Result is the same. I've changed ImagePath string in the registry for FB 2.5 service, it looks now like this:

C:\>sc qc FirebirdServerfb25sC | findstr /i /c:path BINARY_PATH_NAME : C:\1INSTALL\FIREBIRD\fb25sC\bin\fb_inet_server.exe -s fb25sC -m -i

-- and then restart FB and repeat commands mentioned above.

Output is:

C:\1INSTALL\FIREBIRD\fb25sC\bin>isql -q SQL> shell del c:\temp\tmp25_d1_*.fdb; SQL> set sql dialect 1; SQL> create database 'c:\temp\tmp25_d1_local.fdb'; SQL> select cast(1e19 as varchar(30)) from rdb$database;

CAST

1.000000000000000e+019

SQL> quit;

C:\1INSTALL\FIREBIRD\fb25sC\bin>isql -q SQL> shell del c:\temp\tmp25_d1_*.fdb; SQL> set sql dialect 1; SQL> create database 'localhost/3255:c:\temp\tmp25_d1_remote.fdb'; SQL> select cast(1e19 as varchar(30)) from rdb$database;

CAST

1.000000000000000e+019

firebird-automations commented 9 years ago

Commented by: @asfernandes

Cannot reproduce in Linux.

firebird-automations commented 9 years ago
Modified by: @dyemanov Fix Version: 3\.0\.0 \[ 10048 \]
firebird-automations commented 9 years ago

Commented by: @hvlad

I confirm that embedded on Windows produced 2 digits in exponent while standalone server produced 3 digits. This is related with CORE1171 which goal was to "make floating point's exponential format the same across platforms" (this is original desription of the ticket). So the questions is: - how many digits in exponen is printed on Linux currently ? - should we move _set_output_format() call from isql into engine ?

firebird-automations commented 9 years ago

Commented by: @pavel-zotov

> - how many digits in exponen is printed on Linux currently ?

Currenlty one may see always *two* digits, regardless of protocol.

$ /opt/fb30sc/bin/isql -q SQL> set sql dialect 1; SQL> create database '/var/db/fb30/tmp20151104_1645.fdb'; SQL> select cast(1e19 as varchar(30)) from rdb$database;

CAST

1.000000000000000e+19

SQL> quit;

$ /opt/fb30sc/bin/isql -q SQL> set sql dialect 1; SQL> create database 'localhost/3330:/var/db/fb30/tmp20151104_1646.fdb'; SQL> select cast(1e19 as varchar(30)) from rdb$database;

CAST

1.000000000000000e+19

SQL> show version; ISQL Version: LI-V3.0.0.32136 Firebird 3.0 Release Candidate 1 Server version: Firebird/Linux/AMD/Intel/x64 (access method), version "LI-V3.0.0.32136 Firebird 3.0 Release Candidate 1" Firebird/Linux/AMD/Intel/x64 (remote server), version "LI-V3.0.0.32136 Firebird 3.0 Release Candidate 1/tcp (oel64)/P13" Firebird/Linux/AMD/Intel/x64 (remote interface), version "LI-V3.0.0.32136 Firebird 3.0 Release Candidate 1/tcp (oel64)/P13" on disk structure version 12.0

firebird-automations commented 8 years ago
Modified by: @dyemanov Fix Version: 3\.0 RC2 \[ 10048 \] =\>