Ability to create database with length more than 255 characters should be 
prohibited
------------------------------------------------------------------------------------

                 Key: CORE-6248
                 URL: http://tracker.firebirdsql.org/browse/CORE-6248
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 3.0.5, 4.0 Beta 1
            Reporter: Pavel Zotov
            Priority: Minor


Following script illustrates athe problem (of course, most probably it can 
occur with too long PATH that contains from dozen of nested folders rather than 
single file name):

set list on;

shell del 
C:\temp\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123.fdb
 2>nul;
shell del 
C:\temp\1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234.fdb
 2>nul;
shell del 
C:\temp\12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678.fdb
 2>nul;

--set echo on;


-- Length of full path + file name = 255 bytes is maximal limit for DB 
referencing using mon$database_name and/or rdb$get_context('SYSTEM', 'DB_NAME'):
create database 
'C:\temp\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123.fdb';

show database; -- passed OK

select mon$database_name, rdb$get_context('SYSTEM', 'DB_NAME') from 
mon$database; -- passed OK

commit;
drop database;


------------------------------------------------------------------------ this 
needs to be fixed: -------------------------------------------------------------

-- When length of full path+file name is 256 then DB is created but can not be 
referred using RDB$GET_CONTEXT() or MON$DATABASE:
create database 
'localhost:C:\temp\1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234.fdb';

show database; -- passed OK. WHY ??

select mon$database_name from mon$database; -- Statement failed, SQLSTATE = 
22001 / ... -string right truncation / -expected length 255, actual 256

select rdb$get_context('SYSTEM', 'DB_NAME') from mon$database; -- Statement 
failed, SQLSTATE = 22001 / ... -string right truncation / -expected length 255, 
actual 256

commit;

drop database;




PS.

-- When length of full path+file name is 260 then "the system cannot find the 
path specified" raises.
-- Statement failed, SQLSTATE = 08001 / I/O error during "CreateFile (create)" 
operation for file ... / -Error while trying to create file
create database 
'localhost:C:\temp\12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678.fdb';
drop database;
quit;


-- 
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

        


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to