An external routine with an EXTERNAL SECURITY clause DEFINER authorization uses the OS user authorization that is associated with the creator of the authorization object.
An external routine with an EXTERNAL SECURITY clause INVOKER authorization uses the OS user authorization that is associated with the database user who invokes it.
- All use the same OS user authorization, that of the user who created the authorization, when the routine is defined with a DEFINER authorization.
- All use a different OS user authorization, that of the user who invokes the routine, when the routine is defined with an INVOKER authorization.
The following table summarizes these differences:
OS User Authorization for External Routine | Authorization Type |
---|---|
Independent of user who runs routine | DEFINER |
Specified by user who runs routine | INVOKER |
When you define an INVOKER authorization, the database creates a second authorization named INVOKER_AUTH under the same database (see the report on the next page).
There can only be one INVOKER authorization per database, so when one is defined, the database creates one entry using the specified name and another, duplicate, entry using the name INVOKER_DEFAULT, both of which are stored in DBC.TVM. Apart from their names, the two INVOKER default entries are identical.
When you specify an EXTERNAL SECURITY INVOKER clause for a UDF, no authorization name exists. The database looks up the INVOKER_DEFAULT name in DBC.TVM for the current database, where it finds a correct entry because there can only be one per database.
If you DROP AUTHORIZATION specifying the name you created for it, the database drops both entries.
SELECT * FROM DBC.authorizationsV ORDER BY databasename;