# \[FEATURE-10121\] Postgres RETURNING on named query

**URL:** <https://forum.inductiveautomation.com/t/feature-10121-postgres-returning-on-named-query/24814>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [May 9, 2019, 3:17am UTC](https://forum.inductiveautomation.com/t/feature-10121-postgres-returning-on-named-query/24814 "2019-05-09T03:17:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mitchell-ACS](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mitchell-acs/32/30062_2.png) [@mitchell-ACS](https://forum.inductiveautomation.com/u/mitchell-ACS)\
**Post date:** [May 9, 2019, 3:17am UTC](https://forum.inductiveautomation.com/t/feature-10121-postgres-returning-on-named-query/24814/1 "2019-05-09T03:17:50Z")

</div>

I am trying to set up some insert postgres db queries in named queries that I had in system.db.runPrepUpdate previously, but I am having issues getting the pkey to return when I do an insert statement. the only thing getting returned is a “1”. If I add `RETURNING id` to the query, I get the following error:

 ![04%20PM](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/30cd11bff8e6c2fd4aac607ee6335d3b29d5915d.jpeg)  
Here is the query I am using:  
 ![41%20PM](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/a3297d0923746fe726fdac8fe597609e0087de9e.png)

Any help is appreciated, thanks!

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [May 9, 2019, 2:05pm UTC](https://forum.inductiveautomation.com/t/feature-10121-postgres-returning-on-named-query/24814/2 "2019-05-09T14:05:26Z")

</div>

We have a ticket to add that in to named queries. I’ll link your post to the ticket, which will help it get more attention.

---

<div class="post-metadata">

**Author:** ![mitchell-ACS](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mitchell-acs/32/30062_2.png) [@mitchell-ACS](https://forum.inductiveautomation.com/u/mitchell-ACS)\
**Post date:** [May 9, 2019, 4:47pm UTC](https://forum.inductiveautomation.com/t/feature-10121-postgres-returning-on-named-query/24814/3 "2019-05-09T16:47:22Z")

</div>

Is there any workaround currently?  
Can I use a system.db.runPrepUpdate on a Perspective event script?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 9, 2019, 4:49pm UTC](https://forum.inductiveautomation.com/t/feature-10121-postgres-returning-on-named-query/24814/4 "2019-05-09T16:49:09Z")

</div>

Yes, you can run system.db. functions from scripts in Perspective.

---

<div class="post-metadata">

**Author:** ![mitchell-ACS](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mitchell-acs/32/30062_2.png) [@mitchell-ACS](https://forum.inductiveautomation.com/u/mitchell-ACS)\
**Post date:** [May 9, 2019, 4:50pm UTC](https://forum.inductiveautomation.com/t/feature-10121-postgres-returning-on-named-query/24814/5 "2019-05-09T16:50:04Z")

</div>

Alright I will stick with that. Thanks @paul-griffith and @KathyApplebaum

---

<div class="post-metadata">

**Author:** ![awalker](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/awalker/32/6874_2.png) [@awalker](https://forum.inductiveautomation.com/u/awalker)\
**Post date:** [June 10, 2019, 11:26pm UTC](https://forum.inductiveautomation.com/t/feature-10121-postgres-returning-on-named-query/24814/6 "2019-06-10T23:26:35Z")

</div>

This feature was added in the 8.0.3 nightly build that was uploaded today (6/10).
