# Query Error: GatewayException: Unknown SQL type: 2003 	caused by SQLException: Unknown SQL type: 2003

**URL:** <https://forum.inductiveautomation.com/t/query-error-gatewayexception-unknown-sql-type-2003-caused-by-sqlexception-unknown-sql-type-2003/86308>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [February 24, 2024, 1:33pm UTC](https://forum.inductiveautomation.com/t/query-error-gatewayexception-unknown-sql-type-2003-caused-by-sqlexception-unknown-sql-type-2003/86308 "2024-02-24T13:33:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oscar\_Simon](https://avatars.discourse-cdn.com/v4/letter/o/bc79bd/32.png) [@Oscar\_Simon](https://forum.inductiveautomation.com/u/Oscar_Simon)\
**Post date:** [February 24, 2024, 1:33pm UTC](https://forum.inductiveautomation.com/t/query-error-gatewayexception-unknown-sql-type-2003-caused-by-sqlexception-unknown-sql-type-2003/86308/1 "2024-02-24T13:33:55Z")

</div>

I've encountered an issue while running a query, and I'm receiving the following error: _ **GatewayException: Unknown SQL type: 2003, caused by SQLException: Unknown SQL type: 2003** _. My database is Postgres, and I'm unsure if the problem is related to the functions I'm using in my query, specifically ARRAY\_LENGTH and ARRAY\_AGG. I've already updated the JDBC driver for Postgres to version 42.7.2. Any insights or suggestions would be greatly appreciated. My query works in pgAdmin.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 24, 2024, 3:35pm UTC](https://forum.inductiveautomation.com/t/query-error-gatewayexception-unknown-sql-type-2003-caused-by-sqlexception-unknown-sql-type-2003/86308/2 "2024-02-24T15:35:12Z")

</div>

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:

> [@Taking a Dataset and Inserting it to a SQL temp table](https://forum.inductiveautomation.com/t/taking-a-dataset-and-inserting-it-to-a-sql-temp-table/83852/4):
>
> If you were using a competent database (the following is PostgreSQL), you can pass java arrays as arguments, and unnest() them in a FROM clause. For an example, I created a table in my psql forum playground called phrases, to be used in a join. When queried by itself, you get this dataset: "#NAMES" "prefix","suffix" "#TYPES" "str","I" "#ROWS","4" "Hello","1" "Good Bye","2" "Welcome to","3" "Whoa!","4" To go with that, in a custom property named lookups, I created the following unbound datase…
