I am currently using PostgreSQL (with timescale) to store some data, and I'm experimenting with the native postgres arrays.
Apparently, it is absolutely no problem to write natively in the arrays with a system.db.runPrepUpdate, but when I try to read the columns back, I am unable to do so without wrapping the column in an ARRAY_TO_JSON statement.
I ignore if this depends on the JDBC driver. I tried both with the one that comes with Ignition 8.1.31 (v. 42.2.18) and with the latest available (42.6.0).
I would like to know if anybody else encountered the same issue or if it is an expected limitation. Native PostgreSQL array are kinda neat, but if I have to cast them to JSON to retrieve the data, I would use directly JSON to start with.
That's a very interesting approach, but wouldn't it go against the DB agnostic approach you highlighted in your first reply?AFAIK, unnest is not a native MySQL function, and in the topic you pointed out it seems to also be out of MSSQL.
UNNEST is in the SQL standard. Oracle has equivalent functionality with different syntax (the predefined collections tools, from what I understand). This functionality is also present (as UNNEST) in Google's cloud data warehouse. Presumably others.
Microsoft simply lags other platforms, and has for many years.
My bias towards DB-agnostic solutions is to avoid vendor lock-in. My bias towards PostgreSQL is due to their stated policy of hewing close to the standard wherever possible. This means that queries written for PostgreSQL tend to work in other DBs, when the functionality involved is present, and the other DB's "standards compliant mode" is turned on. (MS SQL Server does not turn that on by default--another strike against them in my book.)