User Functions

I l @ ve RuBoard

User Functions

Several of the included functions in PostgreSQL deal with user and session issues. The following sections discuss user- related functions.

CURRENT_USER

Description

The CURRENT_USER function returns the user ID being used for permission checking.

Inputs

None.

Example
 SELECT CURRENT_USER;  -------------- webuser 
Notes

Currently, CURRENT_USER and SESSION_USER are the same, but in the future, there might be a distinction as needed for programs running in a setuid mode.

Notice that the preceding function is not called with the trailing parentheses "()". This is to maintain SQL compatibility.

SESSION_USER

Description

The SESSION_USER function returns the user ID that is currently logged into PostgreSQL.

Inputs

None.

Example
 SELECT SESSION_USER;  -------------- webuser 
Notes

Currently, CURRENT_USER and SESSION_USER are the same, but in the future, there might be a distinction as needed for programs running in a setuid mode.

Notice that the preceding function is not called with the trailing parenthesis "()". This is to maintain SQL compatibility.

USER

Notes

See CURRENT_USER.

I l @ ve RuBoard


PostgreSQL Essential Reference
PostgreSQL Essential Reference
ISBN: 0735711216
EAN: 2147483647
Year: 2001
Pages: 118
Authors: Barry Stinson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net