Questions tagged [pg-notify]
14 questions
9
votes
1 answer
LISTEN/NOTIFY on AWS Aurora/postgres
I am hoping to implement a trigger that fires a notify on table change in PostgreSQL, but I am unable to find any definite answer to if it would work in a cluster.
Does PostgreSQL listen/notify work on AWS Aurora (both provisioned and serverless),…

Wodsee
- 93
- 4
3
votes
2 answers
How to correctly listen for a postgresql notification from node.js
Objective:
When a new record is inserted into a specific PostgreSQL table, I would like PostgreSQL to notify my node.js web application so that it can initiate an API call to an external service.
I understand the basic steps are:
Establish a…

Michael
- 31
- 3
3
votes
0 answers
How do i get PostgreSQL notifications work with python?
i was trying to follow this example from stackoverflow using pg_notify with python. I am not getting this to work. Nothing happens and python does not receive the notification.
Python 3.85 Using Psycopg2. PostgreSQL 13
python & postgresql: reliably…

user2238704
- 121
- 8
2
votes
1 answer
Why am I unable to UPDATE a Postgresql table where I have a TRIGGER defined with BEFORE UPDATE
In PostgreSQL, I have a table with a trigger defined which calls a defined PostgreSQL function. The trigger is BEFORE UPDATE. With the trigger defined, I am unable to make updates to the table in question. If I redefine the trigger as AFTER UPDATE…

mick
- 51
- 3
2
votes
2 answers
Postgred pg_notify/listen only working if channel name is lower case
I've read https://www.postgresql.org/docs/9.6/static/sql-notify.html and the channel name is just described as an 'identifier'.
I'm using NodeJS and pg https://www.npmjs.com/package/pg to access postgres.
If I use a lower case word in both, e.g.…

fadedbee
- 42,671
- 44
- 178
- 308
1
vote
2 answers
Debug Postgres 'too many notifications in the NOTIFY queue'
I am using a Postgres table which gets 2000-3000 updates per second.
I am using for update this table queries generated with the update helper of pg-promise library.
Each update triggers a notify with pg_notify() function. Some nodejs scripts are…

Arian Mareș
- 46
- 8
1
vote
1 answer
In postgres db how do we get notifications or triggeres when the future column data (with timestamp) meets current time
From UI user will give us some specific time (with timezone )for updating the exe version on the devices
which we are storing in postgresql db as demandedInstallationTime.
-------------------------------------------------------------
| Id |…

Rekha
- 11
- 2
1
vote
0 answers
How to get the event name from pg_notify
I'm getting the event(delete or create) from pg_notify with python using pg_channels but I need to put an if to check if the trigged event is a delete or create, than I can apply a rule but I don't know how to get the event name.
Thanks for your…

Diogo Silva
- 195
- 3
- 17
1
vote
1 answer
Alias column name in Postgres notify
I am using trigger in Postgres database to call function and send newly inserted row to NodeJs application
CREATE OR REPLACE FUNCTION triggerFunction() RETURNS trigger AS $$
DECLARE
BEGIN
PERFORM pg_notify('tableName', row_to_json(NEW)::text…

ashu
- 1,197
- 2
- 14
- 30
0
votes
1 answer
How to receive postgres trigger notification in python using pg_notify quickly or real time with bulk records
I have trigger of after update / after insert and have python listener using pg_notify.
Trigger:
DECLARE
channel text :='test_channel';
BEGIN
RAISE NOTICE 'channel % % ',id;
PERFORM…

jayashri sathe
- 75
- 1
- 7
0
votes
1 answer
How can I monitor pg_notify data?
I am handling the application which use pg_notify to capture any data based on event insert, update, and delete. The problem is some of data were not synced properly. Now with this regard, I would like to monitor every single data notified by…

Henz
- 1
0
votes
0 answers
PGNotificationListener not called after pg_notify inside PostgreSQL database
1, design a simple table inside postgresql with trigger function added, which will send pg_notify message when any update/delete/add into a table.
peace of trigger code:
{
notification = json_build_object('table', TG_TABLE_NAME,
…

Steven
- 1
0
votes
1 answer
Postgres: No payload received when using pg_notify with `node-postgres` Javascript library
I have specified a function that is executed after inserting a row to a table. This function uses pg_notify function to notify channel jobqueue with JSON payload of new row.
job_notifier function:
CREATE FUNCTION job_notifier() RETURNS TRIGGER AS…

user3056783
- 2,265
- 1
- 29
- 55
-1
votes
1 answer
Running a Postgres SELECT within a pg_notify
Can I run (and return the results of) a SELECT query within a pg_notify?
My old code worked:
CREATE OR REPLACE FUNCTION outbound_notify_fn() RETURNS trigger AS $$
BEGIN
PERFORM pg_notify('outbound_notify', json_build_object('table', TG_TABLE_NAME,…

fadedbee
- 42,671
- 44
- 178
- 308