SET OWNER
The SET OWNER statement allows you to specify one or more owner names for use during the current database connection. An owner name is assigned only through the MicroKernel Engine, not through the Relational Engine. Note that no relationship exists between an owner name and any system user name or database user name. Think of an owner name as a simple file password that, if assigned, is required to access a data file. For more information on owner names, see
Syntax
SET OWNER = [']ownername['] [,[']ownername[']] ...
Remarks
The SET OWNER statement allows you to specify a list of owner names for data files that have owner names assigned through the MicroKernel Engine. PSQL passes the owner names to the Relational Engine, enabling the Relational Engine to open the data files.
You can specify any number of owner names with a SET OWNER statement. If an owner name begins with a nonalphabetic character, you must enclose the name in single quotes (' ').
The statement is effective for the current connection only. If the current user logs out after issuing a SET OWNER command, the user must reissue the command the next time the user logs in.
Each SET OWNER statement issued during the same connection resets the owner list. That is, only the owner names specified in the most recent SET OWNER statement are passed to the database engine. You cannot add owner names to the owner list with subsequent statements.
In a database with security turned Off, this command allows full access to any data file that has an owner name the same as any name supplied in the SET OWNER list.
In a database with security turned On, this command has no effect for most users. It only has an effect when it is issued by the Master user. If the Master user has not granted himself permissions yet, issuing this command gives the Master user full access to any data file with one of the specified owner names. Also, if the Master user chooses to give himself permissions, he has two options. The Master user can issue a SET OWNER followed by a GRANT without an owner name, or the Master user can issue a GRANT that specifies the owner name. See Examples.
Examples
The following example specifies one owner name.
SET OWNER = '12jerry'
============ 
The following examples specify several owner names.
SET OWNER = jimbo, terry, maximus
 
SET OWNER = 'svrkl77x#region5data', jimbo, terry, maximus
============ 
The following example shows the effects of multiple SET OWNER statements within the same connection.
SET OWNER = jimbo, terry, maximus
--owner list contains: jimbo,terry,maximus.
SET OWNER = fred, jennie, lucinda
--owner list now contains: fred,jennie,lucinda. Previous contents are discarded.
============ 
The following example demonstrates the usage of SET OWNER for the Master user in a secure database. Assume that security has just been turned on, and no permissions have been granted in the database. The inventory data file has the owner name admin.
To grant himself permissions, the Master user has two options. The Master user can issue a SET OWNER followed by a GRANT without an owner name, or the Master user can issue a GRANT that specifies the owner name. Both methods achieve the same result:
SET OWNER = admin
GRANT ALL ON inventory TO MASTER
or
GRANT ALL ON inventory admin TO MASTER
See Also
GRANT
REVOKE