Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect size of the output parameter/argument when execute block, procedure or function use system field in metadata charset [CORE4566] #4883

Closed
firebird-automations opened this issue Oct 1, 2014 · 12 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @sim1984

Is related to QA613

Incorrect size of the output argument when connection character set does not match the character set of the return argument.

Database created with character set win1251.

CREATE OR ALTER FUNCTION GET_MNEMONIC (
AFIELD_NAME TYPE OF COLUMN RDB$TYPES.RDB$FIELD_NAME,
ATYPE TYPE OF COLUMN RDB$TYPES.RDB$TYPE)
RETURNS TYPE OF COLUMN RDB$TYPES.RDB$TYPE_NAME
AS
begin
RETURN (SELECT RDB$TYPE_NAME
FROM RDB$TYPES
WHERE RDB$FIELD_NAME = :AFIELD_NAME
AND RDB$TYPE = :ATYPE);
end

Use CONNECT or CREATE DATABASE to specify a database
SQL> set names win1251;
SQL> connect 'localhost:test' user 'sysdba' password 'masterkey';
Database: 'localhost:horses', User: sysdba
SQL> select GET_MNEMONIC('MON$SHUTDOWN_MODE', 1) AS MNEMONIC
CON> from rdb$database;

MNEMONIC

Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 10, actual 19

SQL> select cast(GET_MNEMONIC('MON$SHUTDOWN_MODE', 1) as varchar(100)) AS MNEMONIC
CON> from rdb$database;

MNEMONIC

===============================================================================
MULTI_USER_SHUTDOWN

SQL> SELECT
CON> RDB$TYPE_NAME
CON> FROM
CON> RDB$TYPES
CON> WHERE RDB$FIELD_NAME = 'MON$SHUTDOWN_MODE'
CON> AND RDB$TYPE = 1;

RDB$TYPE_NAME

MULTI_USER_SHUTDOWN

Commits: b294402 aea3784 e8930f4 FirebirdSQL/fbt-repository@9b00340 FirebirdSQL/fbt-repository@52ef861

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @sim1984

In Firebird 2.5.3 also reproduced

execute block
returns (
FIELD_NAME RDB$FIELD_NAME
)
as
begin
for select rdb$type_name
from rdb$types
into FIELD_NAME
do
suspend;
end

@firebird-automations
Copy link
Collaborator Author

Modified by: @sim1984

Version: 2.5.3 [ 10461 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

This bug seems to affect all firebird versions, but in later versions shows itself more active due to more ablities to use type of system objects in procedures and functions.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

Version: 2.1.6 [ 10460 ]

Version: 3.0 Alpha 1 [ 10331 ]

Version: 2.5.2 Update 1 [ 10521 ]

Version: 2.1.5 Update 1 [ 10522 ]

Version: 2.5.2 [ 10450 ]

Version: 2.1.5 [ 10420 ]

summary: Incorrect size of the output argument when connection character set does not match the character set of the return argument => Incorrect size of the output argument when procedure or function use system field in metadata charset

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

summary: Incorrect size of the output argument when procedure or function use system field in metadata charset => Incorrect size of the output parameter/argument when procedure or function use system field in metadata charset

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

summary: Incorrect size of the output parameter/argument when procedure or function use system field in metadata charset => Incorrect size of the output parameter/argument when execute block, procedure or function use system field in metadata charset

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Also fixed in B2_1, but there is no appropriate version in "Fix Version/s" list.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Beta 1 [ 10332 ]

Fix Version: 2.5.4 [ 10585 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 2.1.7 [ 10651 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA613 [ QA613 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment