# 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:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aisha\_Shiddat](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@Aisha\_Shiddat](https://forum.inductiveautomation.com/u/Aisha_Shiddat)\
**Post date:** [March 26, 2024, 6:30pm UTC](https://forum.inductiveautomation.com/t/issues-with-creating-query-postgres-db/87919/1 "2024-03-26T18:30:06Z")

</div>

I am trying to create a simple named query from a Postgres DB and I keep getting an error:

GatewayException: java.sql.SQLException: Unknown SQL type: 2003  
caused by Exception: java.sql.SQLException: Unknown SQL type: 2003

===================Query======================================  
select id, lastmodified, time, measuringlocation, userequationresults, morphologytype, uts, oxygen, siequivalent from thermalanalyses where measuringlocation= :measuringloc  
order by lastmodified desc

is there a solution or workaround for this issue?

---

<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:
