Error Occurred: S1001 Out of memory while reading tuples.;memory allocation error?

Good Day All
i have taken over a TPS, Legacy Program that i am converting to Postgres, ABC.

I keep getting this “Error Occurred: S1001 Out of memory while reading tuples.;<0AH>memory allocation error???”
This happens on both reports and browses but the common thread seems to be that multiple files are joined using the dictionary relationships.
After some investigation it seem like the prepared statement sent to postgres uses >= instewad of = for linking to my Primary Key Guid (String16).
If i run this with an example GUID the backend seems to try evaluate it as a number and its getting the more than just the records that match.

How do i force the code to be an = to stop this?

Here is an example of the Prepared Statement where PK_Stock_Items_GUID is a string(16)

SELECT PK_STOCK_ITEMS_GUID,SK_STOCK_ITEMS
	FROM public.Stock_Items 
	WHERE (PK_STOCK_ITEMS_GUID <= ? ) 
	ORDER BY PK_STOCK_ITEMS_GUID DESC 

This is what it should look like after the variable is set.

SELECT PK_STOCK_ITEMS_GUID,SK_STOCK_ITEMS
	FROM public.Stock_Items 
	WHERE (PK_STOCK_ITEMS_GUID = '5HS23GMH6ZF6CRST' ) 
	ORDER BY PK_STOCK_ITEMS_GUID DESC 

This code returns 1 Record - Correct.
If you run the prepared statement with the <= it returns 58000 records - Very wrong.

Are the relationships defined the right way? ie are they defined as 1:many instead of many:1 ?

It might be a fairly common error with Postgres since there are plenty of posts. I don’t know what your solution is, but this one seems fairly generic…

Good Day @seanh
Majority of the relations in this DB are actually 1 to 1 records,
Ie this LotItem = this Stock Item.
Unfortunately there isnt a way to set this that i can find.
i have however set it so the many is on the side that has the highest chance of having a “duplicate”.
in the above example the stock is the 1 and the LotItem is the many

Hey @PurpleEdge2214
I have tried this but it just seems to stop all my browses getting any data back completely, so while it removes the error it starts its own.

I know it is 100% the relationship and the prepared statement that is being created which is causing the error to be thrown as i can remove the joins and code the conneciton manually and it runs but is incredibly slow as i have to do an access for every record in a browse that can display 100k records.

i have noticed though it does seem to be specific tables so @seanh note about the relationship set up might be the answer but im not sure how to fix it as they seem to be defined correct.

All i want the prepared statement to set is Where FK_Guid = PK_Guid Join the tables but its adding a >= which is causing the issue.
For referece, if i hand code a View using my join statement it works perfectly.

I would try wizarding an ABC app using the files in question.

I’m not sure that there is an error in the join, it will be interesting to see what is generated by the wizarded app.

In this situation I sometimes setup 2 relations, 1 each way, that means using an Alias so that both tables can effectively be the parent, depending on the procedure that ends up be effective. Based on what you say you want this record to be the parent, so that there is only one of them.