Idea Summary
Enhance the "Audit Columns" setting in Quick SQL by including the PROXY_USER context from USERENV when setting the created_by and updated_by columns in the generated triggers. Currently, the value is set using:
:new.created_by := coalesce(sys_context('APEX$SESSION','APP_USER'),user);
:new.updated_by := coalesce(sys_context('APEX$SESSION','APP_USER'),user);
This should be extended to also include sys_context('USERENV','PROXY_USER') to better support proxy users.
Use Case
In projects where proxy user is used the actual user performing the action may be available via sys_context('USERENV','PROXY_USER'). The current implementation in Quick SQL ignores this context, resulting in audit columns capturing the database user (USER) or the APEX user, but not the true acting user. This leads to incomplete or misleading audit information.
Preferred Solution (Optional)
I see two options.
- The “Audit Columns” setting should always include code sys_context('USERENV','PROXY_USER') in generated triggers.
- A new setting will be added (for example, in the Options section) called "Proxy Users" or something similar. After enabling it, the code sys_context('USERENV','PROXY_USER') will be added to generated triggers.