notice / notification logging from PostgreSQL is not working
See original GitHub issueIssue Description
Im trying to use afterConnect hook to intercept notice and notiification events from a PostgreSQL database
What are you doing?
const config = {
username: 'username',
password: 'password',
database: 'database',
host: 'host',
dialect: 'postgres',
logging: true,
pool: {
max: 1,
min: 1,
acquire: 30000,
idle: 10000
}
}
const sequelize = new Sequelize(config);
sequelize.addHook('afterConnect', (client) => {
//never fired
client.on('notice', msg => {
console.log('notice:', msg)
})
//never fired
client.on('notification', msg => {
console.log(msg.channel)
console.log(msg.payload)
})
});
await sequelize.query('any query that triggers a notice or notification');
What do you expect to happen?
I wanted to the notice or notification event called at least once
What is actually happening?
The events are never fired
No output
Additional context
Add any other context or screenshots about the feature request here.
Environment
- Sequelize version: sequelize@5.19.4
- Node.js version: v9.11.1
- Operating System: Ubuntu 16.04
Issue Template Checklist
How does this problem relate to dialects?
- I think this problem happens regardless of the dialect.
- I think this problem happens only for the following dialect(s): pg@7.12.1
- I don’t know, I was using PUT-YOUR-DIALECT-HERE, with connector library version XXX and database version XXX
Would you be willing to resolve this issue by submitting a Pull Request?
- Yes, I have the time and I know how to start.
- Yes, I have the time but I don’t know how to start, I would need guidance.
- No, I don’t have the time, although I believe I could do it if I had the time…
- No, I don’t have the time and I wouldn’t even know how to start.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
PostgreSQL: Documentation: 15: NOTIFY
The NOTIFY command sends a notification event together with an optional “payload” string to each client application that has previously executed LISTEN channel ......
Read more >Raise NOTICE, Raise INFO not saved to logs in POSTGRES
My intention here is to store the notice , info from this procedure to postgres logs (txt files) that are stored in the...
Read more >Not able to print raise notice output in log file tried with all ...
1 Answer 1 · Its working but its not printing result in log file like if I am giving \o \tmp\Logfile. · @SamirMjs...
Read more >PostgreSQL Logs Explained: Logging Configuration Tutorial
NOTICE : Offers useful information to users like identifier truncation; WARNING: Delivers warnings of likely problems; ERROR: Registers errors, ...
Read more >PostgreSQL LISTEN/NOTIFY
It's possible for our trigger to notify an external client. ... commit log is serialized, so there's no extra work for PostgreSQL here....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
yes, i tried without sequelize, the library in this case is pg (example code):
in this snippet the console.log actually run
repo query updated, tests passed, Thanks!