rdb$db_key cannot be used in psql with a char(8) as documented --------------------------------------------------------------
Key: CORE-5810 URL: http://tracker.firebirdsql.org/browse/CORE-5810 Project: Firebird Core Issue Type: Bug Components: Engine Affects Versions: 2.5.7 Environment: Linux - fedora 26 Reporter: Ray Holme SQL script follows: ---- select rdb$db_key, recordid from invoice; set term ^; create or alter procedure fubar returns (recordid integer) as declare variable align1 DECIMAL(18, 4); declare variable rdb_id char(8); declare variable align2 DECIMAL(18, 4); begin align1= 1; align2= 1; for select rdb$db_key from invoice into :rdb_id do begin select recordid from invoice where rdb$db_key = :rdb_id into :recordid; suspend; end end^ set term ;^ select distinct 'failure coming' from invoice; select * from fubar; ---- ---- results shown below - procedure should have returned the 9 keys shown in the select output DB_KEY RECORDID ================ ============ A800000002000000 1 A800000004000000 2 A800000006000000 3 A800000008000000 4 A80000000A000000 5 A80000000C000000 6 A80000000E000000 7 A800000010000000 10 A800000012000000 11 CONSTANT ============== failure coming RECORDID ============ Statement failed, SQLSTATE = 22000 Malformed string -At procedure 'FUBAR' line: 4, col: 3 After line 13 in file /tmp/try.sql ------ a) this should work as shown in the book b) perhaps PSQL needs a new type (FB_QUAD == GDS_QUAD == ISC_QUAD or ....) instead of a char, this type should probably look and feel like a 64 bit int, or 2 32-bit ints alignment properties would then resemble the real thing as found in C c) note that the first byte of the db_key has a high bit of 1 in this case (not so in book) - this might be a problem for a char(8) - not a UCHAR(8) the alignment variables shown in this example were added to see if alignment was the problem but did nothing -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel