FirebirdSQL / firebird

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

[FB3+] RPAD works incorectly in a connection with the charset NONE #7592

Open dmitry-lipetsk opened 1 year ago

dmitry-lipetsk commented 1 year ago

Hello,

When I use connection charset NONE, RPAD generates VARCHAR with length 65533 (==-3)

Is it OK?

FB4

SQL> SET SQLDA_DISPLAY ON;
SQL> show version;
ISQL Version: WI-V4.0.3.2937 Firebird 4.0
Server version:
Firebird/Windows/AMD/Intel/x64 (access method), version "WI-V4.0.3.2937 Firebird 4.0"
Firebird/Windows/AMD/Intel/x64 (remote server), version "WI-V4.0.3.2937 Firebird 4.0/tcp (HOME4)/P17:C"
Firebird/Windows/AMD/Intel/x64 (remote interface), version "WI-V4.0.3.2937 Firebird 4.0/tcp (HOME4)/P17:C"
on disk structure version 13.0
SQL> select RPAD('-',CHARACTER_LENGTH('a'),'a') from RDB$DATABASE;

INPUT message field count: 0

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

RPAD
....

FB3

d:\Program_Files\Firebird_3_0_x64>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> connect inet4://localhost:3060/d:/database/ram/FB30_PORT3060/ibp_test_fb30_d3.gdb  USER 'GAMER' PASSWORD 'vermut';
Database: inet4://localhost:3060/d:/database/ram/FB30_PORT3060/ibp_test_fb30_d3.gdb, User: GAMER
SQL> SET SQLDA_DISPLAY ON;
SQL> show version;
ISQL Version: WI-V3.0.11.33637 Firebird 3.0
Server version:
Firebird/Windows/AMD/Intel/x64 (access method), version "WI-V3.0.11.33683 Firebird 3.0"
Firebird/Windows/AMD/Intel/x64 (remote server), version "WI-V3.0.11.33683 Firebird 3.0/tcp (HOME4)/P15:C"
Firebird/Windows/AMD/Intel/x64 (remote interface), version "WI-V3.0.11.33637 Firebird 3.0/tcp (HOME4)/P15:C"
on disk structure version 12.0
SQL> select RPAD('-',CHARACTER_LENGTH('a'),'a') from RDB$DATABASE;

INPUT message field count: 0

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

RPAD
asfernandes commented 1 year ago

Since in some conditions Firebird allows parameters with length 65533, let's wait for a better moment (v6) and maybe increase it in all conditions.