문제

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!

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top