notify_now

This Release
notify_now 1.0.0
Date
Status
Stable
Abstract
PostgreSQL Extension to send multiple responses from one SQL Query using LISTEN/NOFITY API
Description
This simple extension allows you to return multiple responses from a single query using the built-in PostgreSQL LISTEN/NOTIFY API
Released By
ArturFormella
License
MIT
Resources
Special Files
Tags

Extensions

notify_now 1.0.0

README

notify_now

This simple extension allows you to return multiple responses from a single query using the built-in PostgreSQL NOTIFY API. There are no additional dependencies.

Responses are sent to the application immediately after the function is executed in postgres, so it does not wait for the query or transaction to complete. This allows you to create many interesting functionalities: - start using SQL like GraphQL - query status monitoring - returning part of the result for quick presentation to the end user - returning responses with execution plan - better debugging of a transaction that will be rolled back

Each query can return any number of responses using this method. The PostgreSQL NOTIFY API has many implementations in different languages

NodeJS Example

It contains a complete implementation of NOTIFY event handling in the application. After starting, we see how the messages flow. This is the perfect place to use RxJS or another library for event handling. Build an run:

make install
node ./index.js

Installing

This package installs like any Postgres extension. First say:

make && sudo make install

You will need to have pg_config in your path, Then in the database of your choice say:

CREATE EXTENSION notify_now;

Troubles

Missing libs:

sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache

Custom PotsgreSQL surce folder

make VPATH=/home/user/postgres/src/include

Problem with clang:

make with_llvm=no && sudo make with_llvm=no install