'Range check error' on SELECT with JOIN

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
fred_nd
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 06.04.2006, 17:37

'Range check error' on SELECT with JOIN

Post by fred_nd »

I have a very strange problem with the following SQL query (it was more complex earlier, but this still causes the same problem).

SELECT Sites.Name, Inventory.Name FROM Inventory JOIN (Sites) ON Sites.IndexID = Inventory.SiteID) WHERE Inventory.IndexID = 62;

The error ERangeError "Range check error" appears in this function (or the likes for other data types):
TZRowAccessor.SetPChar

And on these rows in those functions:
FBuffer.Columns[FColumnOffsets[ColumnIndex - 1]]

Debug shows that the ColumnIndex is 2 when the exception appears.

The strange thing it that if I reorganize the SQL query and remove the Inventory.Name or switch place of the Sites.Name and Inventory.Name the problem does not occur. The same if I change so that I select from Sites and JOIN the Inventory table.

My thought is that the columns of the two tables do not add up somehow, and then there are not enough entries in the FColumnOffsets or the FBuffer.Columns. Sadly my Borland C++ Builder 6 do not give me debug info into these arrays.

Both tables has 9 columns with different data types.

I can add the structure of these tables and some data, but I thought that it would be better to see if anyone has some ideas of where to start debugging or maybe even what the error may be.

Thanks.
/Fred
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

I think you best start here :
procedure TZGenericStatementAnalyser.FillFieldRefs and procedure TZGenericStatementAnalyser.FillTableRefs(
I think the join (sites) part isn't parsed correctly.

I would be happy if you can find it and send the patch. If not, please file a bug report at zeosbugs.firmos.at including a very simple test case : a small program, a table create script and some data insert script.

Mark
Post Reply