Subject [IBO] Re: IBO 4.9.14 Build 10 released
Author Svein Erling Tysvær
Why is there any DISTINCT at all in this statement? When using UNION, it is implicitly distinct, if you don't want things to be distinct, you have to use UNION ALL.

If you remove all three DISTINCTs, the result should be the same, the only exception being that it also works on Firebird 1.5.

Though that was from my SQL perspective, I've no clue about the IBO perspective (so you might still get an overflow).

Set

-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of bausufm
Sent: 14. juli 2011 14:55
To: IBObjects@yahoogroups.com
Subject: [IBO] Re: IBO 4.9.14 Build 10 released

Hi Jason,
with this new build 10 i get an exception in ib_schema.pas (line 873) on FB 1.5 Dialect 1. On FB 2.1 it works. build 8 also was ok.
The problem is the "union distinct" part of the statement.

SELECT DISTINCT
C.RDB$CHARACTER_SET_ID
, C.RDB$CHARACTER_SET_NAME
, C.RDB$DEFAULT_COLLATE_NAME
, C.RDB$BYTES_PER_CHARACTER
FROM RDB$RELATION_FIELDS R
JOIN RDB$FIELDS F
ON F.RDB$FIELD_NAME = R.RDB$FIELD_SOURCE
JOIN RDB$CHARACTER_SETS C
ON C.RDB$CHARACTER_SET_ID = F.RDB$CHARACTER_SET_ID
WHERE F.RDB$CHARACTER_SET_ID IS NOT NULL
UNION Distinct
SELECT DISTINCT
C.RDB$CHARACTER_SET_ID
, C.RDB$CHARACTER_SET_NAME
, C.RDB$DEFAULT_COLLATE_NAME
, C.RDB$BYTES_PER_CHARACTER
FROM RDB$CHARACTER_SETS C
WHERE C.RDB$CHARACTER_SET_NAME = ''
String( Cn.CharSet ) + ''
OR C.RDB$CHARACTER_SET_ID <= 4
ORDER BY 1


When i delete the word "distinct" the program gets compiled but i then get an stack overflow:
callstack is:
TIB_Stringlist.GetLinkIndex('.')
TIB_Column.GetCharSetfromSchema
TIB_Column.GetNativeCHarId
TIB_Column.GetCharId
TIB_Column.GetCharSetfromSchema
TIB_Column.GetNativeCHarId
TIB_Column.GetCharId
TIB_Column.GetCharSetfromSchema
...

Additional Info: the default charset of the database is "none"

Regards
Falko