OQL for table order fails because order is not accepted?

0
This OQL gives an error: Select *  from AppstoreAppDemos.Order; An error occurred while executing OQL: OQL query cannot be parsed: SELECT * FROM AppstoreAppDemos.Order; Error on line 1 character 31: no viable alternative at input 'Order' Error on line 1 character 36: mismatched input ';' expecting BY If I rename the entity to anything else and feed that name to the OQL, it works fine. Only when the entity is named Order, the error occurs. The OQL-interpreter seems to recognize it as the start of ORDER BY Renaming my entity Order to something else is a solution, but it is a ridiculous reason for not giving my entity the only correct name: Order. I have tried single and double quotes, but that does not help. You can try it by yourself at https://mydemoversion8-sandbox.mxapps.io/p/OQL Any ideas if there is a workaround for this (other than renaming my entity to anything else than Order) Addition after Martin’s response: “Order” might be a reserved word for sql-statements, but it is perfectly allowed to name your entity 'Order' in Postgres. This is a valid postgresql query: SELECT * FROM public."appstoreappdemos$order" ORDER BY date; The same goes for entities named 'Group' , 'Where' and 'Limit'. The modeler did warn me a while ago that 'Case' is a reserved word and not allowed as entity name. Now using xCase, which looks pretty unprofessional.   Dug into the Javacode and apparently it fails at  IDataTable results = Core.retrieveOQLDataTable(context, OQLTextGetRequest); Tried replacing it with string-variable as a signature IDataTable results = Core.retrieveOQLDataTable(context, OQLQuery); but the same error kept occurring.
asked
2 answers
3

Using your test site I got a valid result encapsulating the whole table name in double quotes:

SELECT *
FROM "AppstoreAppDemos.Order";

results in

appstoreappdemos$order.ID	TotalAmount	Date
48132221017522177	120.00000000	1577833200000
48132221017522178	250.00000000	1580598000000
48132221017522179	300.00000000	1583190000000

 

I am not sure why it works like this and haven’t found documentation pointing in this direction either but I just fiddled around with your demo site for a bit and got this :P

answered
1

Since 'order' is a reserved word in both sql and postgresql I think you'll have to reconsider renaming your table, which should be preferable to any workaround anyway. Maybe the modeler should warn in cases like this. It does so for attributes.

answered