API docs getRecords() gives error with 'related'


#1

I have a table Establishment, and I also have couple of related tables, which I want to fetch on the basis of id field in Establishment.
id of establishment is the foreign key of the other related tables.

The error I get is as below in API Docs when I just enter related=*
The getRecords works fine without * in related.

{
“error”: [
{
“context”: null,
“message”: “Failed to retrieve records from ‘establishment’.\nCDbCommand failed to execute the SQL statement: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near “)”\nLINE 3: WHERE “id” IN () LIMIT 1000\n ^”,
“code”: 500
}
]
}


#2

Could you post the full query? The error does not appear to be related to the related=* parameter.


#3

@jeffreystables
There is no query.

Its just that when I add * in the related, I see the error, other wise I do not.
I am using this in the API DOCs, not sure what are you looking for in query.

Its simple getRecords with table name as ‘establishment’. and * in related


#4

Thank you, so the query is something like http://localhost:8080/rest/db/table?related=*

I have tested this in DSP 1.9.2 with a MySQL DB connection, and can GET /db/{table_name} getRecordsByFilter() with related=* from API Docs without seeing this error. Can you provide some more details on how your environment might be different from mine? I recommend trying the same query from a MySQL client to ensure that it’s the DSP and not the DB that’s causing the error.


#5

Ok @jeffreystables
Let me try and paste the SQL to you which gives an error, as the error only comes sometimes with some * related tables, and not with all.

So it could be due to some data or otherwise with some configuration.
Whatever the issue is since the data is very well getting inserted into the DB, so I guess it should also get shown with DSP’s get records without giving error.

let me try and send you some simple table and data which will reproduce the issue for you.
I use PGSQL by the way. Not sure if that could be the issue.


#6

Thank you for this information. We have tested with PostgreSQL on 1.9.2 and also see no errors or issues with a query like http://localhost:8080/rest/db/table?related=*.