# Postgres node and postgres trigger node

**URL:** <https://community.n8n.io/t/postgres-node-and-postgres-trigger-node/27564>\
**Category:** Questions\
**Tags:** postgres\
**Created:** [June 28, 2023, 5:46pm UTC](https://community.n8n.io/t/postgres-node-and-postgres-trigger-node/27564 "2023-06-28T17:46:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gariva](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gariva/32/17889_2.png) [@gariva](https://community.n8n.io/u/gariva)\
**Post date:** [June 28, 2023, 5:46pm UTC](https://community.n8n.io/t/postgres-node-and-postgres-trigger-node/27564/1 "2023-06-28T17:46:28Z")

</div>

Is there any place I can find more documentation or explanation of how the new postgres nodes work.

I been having problems using the select query with dates fields as criteria and can’ find examples or enough reference to troubleshoot.

I have also tried using the postgres trigger node but keeps giving an error that says that the user does not own the table even though it created the trigger. There is no mention of this on the available documentation.  
thanks in advance.

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [June 29, 2023, 8:00am UTC](https://community.n8n.io/t/postgres-node-and-postgres-trigger-node/27564/2 "2023-06-29T08:00:10Z")

</div>

Hi @gariva, perhaps you can share bit more details on your n8n version, database table structure, your workflow, and the exact errors you are facing?

This will hopefully allow us to provide an example of how to get your queries up and running 🙂

---

<div class="post-metadata">

**Author:** ![gariva](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gariva/32/17889_2.png) [@gariva](https://community.n8n.io/u/gariva)\
**Post date:** [June 29, 2023, 2:09pm UTC](https://community.n8n.io/t/postgres-node-and-postgres-trigger-node/27564/3 "2023-06-29T14:09:28Z")

</div>

Hi @MutedJam, sure and thanks for the answer…

We are running postgres on Amazon RDS. engine version 11.16.  
n8n is cloud version 0.233.1

Here are a couple of screenshots of what i mean regarding the date fields. The field I am using to filter is a TIMESTAMP WITHOUT TIME ZONE type.

 ![Screenshot 2023-06-29 at 09.04.08](https://europe1.discourse-cdn.com/n8n/original/3X/9/1/91a0f87bffd8643b29037338171941cd2b02cff4.png)  
 ![Screenshot 2023-06-29 at 09.00.40](https://europe1.discourse-cdn.com/n8n/original/3X/a/b/ab9877177e074a0e4e1ad4a32d33278d7df71f5d.png)

I will give more detail of the postgres trigger question in a different reply  
Thanks

---

<div class="post-metadata">

**Author:** ![gariva](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gariva/32/17889_2.png) [@gariva](https://community.n8n.io/u/gariva)\
**Post date:** [June 29, 2023, 2:37pm UTC](https://community.n8n.io/t/postgres-node-and-postgres-trigger-node/27564/4 "2023-06-29T14:37:11Z")

</div>

@MutedJam regarding the postgres trigger. I just did another experiment using it…  
I first went to the db and removed any trace of previous n8n triggers.  
Then I ran the postgres trigger on insert event on a specific table.  
To my surprise, after pushing the ‘Listen for event’ button it worked and caught when a record was added, so I pushed the button again and waited for it to work. Sadly it did not. I saw how a new record was added to the table with the trigger not reacting to it. I tried stoping the node from listening but it got hung so I reloaded the workflow.  
Then i presses the ‘listen for event’ button again. The screen shot attached shows the response I got.  
I tried this twice and got the same result.  
My Database now has two n8n objects. A trigger on the table and a Trigger function. Will these Stay there even If I never use the trigger node again?  
Thanks for your support.

 ![Screenshot 2023-06-29 at 09.25.00](https://europe1.discourse-cdn.com/n8n/original/3X/2/b/2beeb95a7982c7106dc7c12c47c1c6e705385645.png)

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [July 3, 2023, 8:30am UTC](https://community.n8n.io/t/postgres-node-and-postgres-trigger-node/27564/5 "2023-07-03T08:30:41Z")

</div>

Hi @gariva, from testing this I was able to reproduce the problem and am honestly not sure how the Select operation of the Postgres node is supposed to work with regards to timestamps. I’ve asked about this internally and will get back to you once I know more.

In the meantime, perhaps you simply want to use the “Execute Query” operation instead of the “Select” operation? This worked fine when testing it just now, I was parsing your time value using an expression of `{{ DateTime.fromFormat('06/28/2023', 'MM/dd/yyyy').toISO() }}`:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/5/b/5b8292b0f3db16bf93269e2db65998859627d780.png)

With regards to your trigger question I wasn’t able to reproduce this but I suppose this might be related to my Postgres role. You probably would have to delete these objects manually. To work around this perhaps you want to avoid using the trigger node and instead use the Schedule trigger combined with the regular Postgres node in order to regularly fetch new rows?

---

<div class="post-metadata">

**Author:** ![gariva](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gariva/32/17889_2.png) [@gariva](https://community.n8n.io/u/gariva)\
**Post date:** [July 3, 2023, 4:50pm UTC](https://community.n8n.io/t/postgres-node-and-postgres-trigger-node/27564/6 "2023-07-03T16:50:17Z")

</div>

HI @MutedJam Thanks for your answer…I am currently using the old postgress node with the run sql option. I am trying to update to the new node and wanted to try the select option… I will use the Excute Query as you suggest.

Regarding the Trigger Node… I am exited this is available as our operation has to send some alerts as soon a something happens (ie: a record is added to a table). this event might not happen often but when it happens it is important to notify as soon as possible. Is there some more info on its inner workitngs? Can I chat, talk or email someone who participated in its development.  
Thanks,  
Gariva

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [July 4, 2023, 5:56am UTC](https://community.n8n.io/t/postgres-node-and-postgres-trigger-node/27564/7 "2023-07-04T05:56:38Z")

</div>

Hi @gariva, tbh I don’t know much about the workings of the Postgres trigger and use my own polling logic. This also means I don’t have to worry about database permissions and roles beyond being able to read them.

That said, the node was originally added by @agobrecht, perhaps he or @marcus can share more details on where there is any way to make this work with databases where you might not have full privileges.

As for a quick fix in the meantime I suspect something like `grant userB to userA;` would do the job based on the error message (where userB is the PostgreSQL role you are using in n8n and userA is the owner of alertas\_rastreo).

---

<div class="post-metadata">

**Author:** ![gariva](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gariva/32/17889_2.png) [@gariva](https://community.n8n.io/u/gariva)\
**Post date:** [July 4, 2023, 5:50pm UTC](https://community.n8n.io/t/postgres-node-and-postgres-trigger-node/27564/8 "2023-07-04T17:50:54Z")

</div>

@MutedJam Thanks for the suggestion… I will reach out to @agobrecht and @marcus and see if they can provide more info…  
Thanks Gariva

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [July 11, 2023, 5:51pm UTC](https://community.n8n.io/t/postgres-node-and-postgres-trigger-node/27564/9 "2023-07-11T17:51:00Z")

</div>

Closed on July 11, 2023, 5:51pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
