# Issues with Creating Query (Postgres DB)

**URL:** <https://forum.inductiveautomation.com/t/issues-with-creating-query-postgres-db/87919>\
**Category:** Ignition\
**Tags:** perspective, namedqueries\
**Created:** [March 26, 2024, 6:30pm UTC](https://forum.inductiveautomation.com/t/issues-with-creating-query-postgres-db/87919 "2024-03-26T18:30:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 26, 2024, 6:44pm UTC](https://forum.inductiveautomation.com/t/issues-with-creating-query-postgres-db/87919/2 "2024-03-26T18:44:08Z")

</div>

Tidied up query.

```auto
SELECT 
    id, 
    lastmodified, 
    time, 
    measuringlocation, 
    userequationresults, 
    morphologytype, 
    uts, 
    oxygen, 
    siequivalent 
FROM thermalanalyses 
WHERE measuringlocation = :measuringloc
ORDER BY lastmodified DESC

```

Answered a month before you asked:

> [@Query Error: GatewayException: Unknown SQL type: 2003 caused by SQLException: Unknown SQL type: 2003](https://forum.inductiveautomation.com/t/query-error-gatewayexception-unknown-sql-type-2003-caused-by-sqlexception-unknown-sql-type-2003/86308/2):
>
> You are trying to retrieve a column or expression result from SQL that yields an array data type. Those don't map to vanilla JDBC, so you can't pull them into Ignition (as arrays). Change your SQL expressions to perform the complete array operation in SQL and return an ordinary data type. As it happens, Ignition's "Prep" queries hand off argument processing to the actual JDBC driver, so it is possible to send arrays to Postgres. See this if you are interested:

---

_[View the full topic](https://forum.inductiveautomation.com/t/issues-with-creating-query-postgres-db/87919)._
