Subject | IBO system table queries will fail with Firebird 2.0! |
---|---|
Author | Thomas Steinmaurer |
Post date | 2005-03-26T17:43:23Z |
Hi Jason,
be aware, IBO system table queries will fail with Firebird 2.0. Firebird
2.0 got more restrictive with using table names where a table alias
has been already defined. For example:
One of IBObjects system table query is:
SELECT RDB$INDEX_SEGMENTS.RDB$FIELD_NAME
, RDB$INDICES.RDB$RELATION_NAME
FROM RDB$RELATION_CONSTRAINTS C
, RDB$INDICES I
, RDB$INDEX_SEGMENTS S
WHERE RDB$CONSTRAINT_TYPE = 'FOREIGN KEY'
AND C.RDB$RELATION_NAME = I.RDB$RELATION_NAME
AND C.RDB$INDEX_NAME = I.RDB$INDEX_NAME
AND I.RDB$INDEX_NAME = S.RDB$INDEX_NAME
ORDER BY 1 ASC
, S.RDB$FIELD_POSITION ASC
The query will fail with the following error message:
Dynamic SQL Error SQL error code = -206 Column unknown
RDB$INDEX_SEGMENTS.RDB$FIELD_NAME At line 1, column 27.
The query will work, if using table aliases in the SELECT field list.
For example:
SELECT S.RDB$FIELD_NAME
, I.RDB$RELATION_NAME
FROM RDB$RELATION_CONSTRAINTS C
, RDB$INDICES I
, RDB$INDEX_SEGMENTS S
WHERE RDB$CONSTRAINT_TYPE = 'FOREIGN KEY'
AND C.RDB$RELATION_NAME = I.RDB$RELATION_NAME
AND C.RDB$INDEX_NAME = I.RDB$INDEX_NAME
AND I.RDB$INDEX_NAME = S.RDB$INDEX_NAME
ORDER BY 1 ASC
, S.RDB$FIELD_POSITION ASC
--
Best Regards,
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
be aware, IBO system table queries will fail with Firebird 2.0. Firebird
2.0 got more restrictive with using table names where a table alias
has been already defined. For example:
One of IBObjects system table query is:
SELECT RDB$INDEX_SEGMENTS.RDB$FIELD_NAME
, RDB$INDICES.RDB$RELATION_NAME
FROM RDB$RELATION_CONSTRAINTS C
, RDB$INDICES I
, RDB$INDEX_SEGMENTS S
WHERE RDB$CONSTRAINT_TYPE = 'FOREIGN KEY'
AND C.RDB$RELATION_NAME = I.RDB$RELATION_NAME
AND C.RDB$INDEX_NAME = I.RDB$INDEX_NAME
AND I.RDB$INDEX_NAME = S.RDB$INDEX_NAME
ORDER BY 1 ASC
, S.RDB$FIELD_POSITION ASC
The query will fail with the following error message:
Dynamic SQL Error SQL error code = -206 Column unknown
RDB$INDEX_SEGMENTS.RDB$FIELD_NAME At line 1, column 27.
The query will work, if using table aliases in the SELECT field list.
For example:
SELECT S.RDB$FIELD_NAME
, I.RDB$RELATION_NAME
FROM RDB$RELATION_CONSTRAINTS C
, RDB$INDICES I
, RDB$INDEX_SEGMENTS S
WHERE RDB$CONSTRAINT_TYPE = 'FOREIGN KEY'
AND C.RDB$RELATION_NAME = I.RDB$RELATION_NAME
AND C.RDB$INDEX_NAME = I.RDB$INDEX_NAME
AND I.RDB$INDEX_NAME = S.RDB$INDEX_NAME
ORDER BY 1 ASC
, S.RDB$FIELD_POSITION ASC
--
Best Regards,
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