Pregunta

The main issue is that I want to audit user behavior (with triggers), but we are currently using connection pooling with our database, so don't have their username/id directly inside the db.

  1. I understand that there is an EXECUTE AS LOGIN function in MSSQL Server. Is there something similar in MySQL or Postgres?

  2. Do I have other options, other than auditing from the ORM and not the database?

Thanks!

¿Fue útil?

Solución

In PostgreSQL you can use SET ROLE or SET SESSION AUTHORIZATION but you must have the role already defined in the database.

You can choose which of them fits better your needs.

Otros consejos

In addition to SET ROLE there is another possibly useful option SET APPLICATION_NAME. This doesn't have to be the application - as long as your app's usernames fit in 64 characters it's very useful for that.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top