Subject Re: [firebird-support] System Tables column sizes
Author Thomas Steinmaurer
> When querying the system table (ie. RDB$RELATIONS) and pull in the
> rdb$relation_name, no matter what data the field may hold, it always
> come back with a data size of 31!
>
> Example: If rdb$relation_name equals 'STORE_NO', it will have a data
> size of 31 when actually, it's 8.
>
> I know that this is because the tables are defined as CHAR types
> instead of VARCHAR.
>
> But because it always comes back with the defined data size it makes
> it extremely difficult to match to the data correctly.
>
> Is there some way to get this data to work like VARCHAR's without
> having to TRIM everything, it's a real pain, when it doesn't have to
> be.

The '=' operator will ignore that:

select rdb$relation_name from rdb$relations
where rdb$relation_name = 'RDB$RELATIONS';

=> Returns 1 record.


Where as the LIKE operator won't ignore that:

select rdb$relation_name from rdb$relations
where rdb$relation_name LIKE 'RDB$RELATIONS'

=> Returns 0 records.


The following will return 1 records again (watch the wrap):

select rdb$relation_name from rdb$relations
where rdb$relation_name like 'RDB$RELATIONS '



--
HTH,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2 (NEW!)
Upscene Productions
http://www.upscene.com