Subject: Re: DBI primary_key tests fail: oracle 8

From: "Andy Hassall" <[email-masked]>
Date: Tue, 6 Jan 2004 23:29:14 -0000

Eric Lenio wrote:
> OK Tim. One other note -- after reading through oracle docs, I think
> you might want to substitute 'session_user' for 'current_schema' in
> 'select sys_context(...)'.  The definition of session_user is
> "returns the database
> user name by which the current user is authenticated" while
> current_schema is "returns the name of the default schema being used
> in the current session".
> Maybe it doesn't matter, I'm not an oracle guru by any stretch of the
> imagination.

There's several usernames in the USERENV context:

CURRENT_SCHEMA

The schema/user used for unqualified object name resolution; by default the
user you logged in as, but alterable with 'alter session set
current_schema=x'. Useful for avoiding having to maintain loads of synonyms.

CURRENT_USER

The user you're currently authenticated as. Doesn't change in SQL and
anonymous PL/SQL, but changes within definer-rights PL/SQL stored procedures
to the owner of the stored procedure, since stored procs by default run with
the privileges of the owner, not the invoker.

SESSION_USER

Who you originally logged in as, and never changes (but see below). Looks
like the appropriate one to use.

PROXY_USER

I don't think DBD::Oracle supports proxy authentication so don't need to
worry about that one yet. Possibly a bit of a grey area if it does support
it in the future, since this would hold the username in the DSN, but it'd
reauthenticate and change the SESSION_USER on connect (which would probably
have to be specified as an attribute to the $dbh).

-- 
Andy Hassall ([email-masked]) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)