06-02-2023 02:58 AM
Hello all,
I have got a strange behavior when requesting 1 record (LIMIT 1) from a Postgres table. The table has 3 fields:
I am executing the following command:
SELECT time, "ID", “Value3” FROM "ExtrudersHead_Measurements_Values_Arr" LIMIT 1
When there are less than 3505 elements in Value3 I get my one record back successfully.
When there are more than 3505 elements in Value3 I get a Labview crash message (see attached file).
What is wrong ?
Thank you very much for any insight
Christophe
06-02-2023 09:16 AM
Unfortunately, I can't open your VI. I just have a bunch of questions about your post. None of them will likely solve your issue.
06-02-2023 09:28 AM
- The reason of the LIMIT 1 is just to be sure that I am asking a very small amount of data back from the server in the recordset. It is of course not something that I plan to use in production
- If I use a WHERE that is supposed to return the least information back, Labview crashes if I define my ARRAY of REAL (Value3) with more than 3500 elements. Same as if I do not use WHERE but LIMIT 1. If I use a WHERE that is supposed to return nothing then Labview does NOT crash and returns nothing (as expected)
- ARRAYS are types that do not exist in SQL SERVER but well in other families of relational database such as POSTGRES of TIMESCALEDB. Very convenient when you have to store a collection of elements acquired at the same timestamp for instance. Way more efficient than storing each element separately like we have to do in SQL Server.
- I have replaced Time and ID with other names and it did not change the problem.
- I am attaching a snapshot of the very basic code that I use.
06-02-2023 09:37 AM
It sounds like LabVIEW doesn't support the array datatype since the only time LabVIEW doesn't crash is when there are 0 records in the recordset. Why not store the data as CSV in a text field type? This can easily be read into LabVIEW and can be converted into an array after the query is executed.
06-02-2023 09:40 AM
No. Labview and the DB Tools support Array Datatype. Like I said in my original post: the restriction that I found does not apply to INTEGER ARRAY (this works with thousand of elements, no problem) but only to REAL ARRAY (above 3500 elements. Below 3500 elements, no problem).
06-02-2023 10:06 AM
I wouldn't call that supported but maybe that's just me. 😉
So why can't you use CSV data stored as text in the dB, as i mentioned before? That, on the other hand, is fully supported and easy to convert to an array in LabVIEW.
06-02-2023 10:09 AM
I do not want to use CSV for various reasons, the most obvious one being wasting so much memory to store REAL or INTEGER into STRINGS...
But let us wait for other Labview/PostGres users feedbacks 😉