[odb-users] schemas and run-time search path

Boris Kolpackov boris at codesynthesis.com
Fri Mar 8 06:14:49 EST 2013


Hi Hugo,

Hugo.Mildenberger at web.de <Hugo.Mildenberger at web.de> writes:

> is it possible to assign a schema name to be used by an object instance 
> at run time?

No, this is not supported. For reasons why, see this earlier post (scroll
down to #3):

http://www.codesynthesis.com/pipermail/odb-users/2011-October/000368.html


> I'm thinking about to map individual users to schemas, hence the question.
> On a second thought, it is probably cleaner to use "set search_path to 
> '<some-schema>'" (on PostgreSQL),

Yes, I think this will work.


> but I miss such an option within the database or connection classes.

The way to do it is to override the create() virtual function on the
connection factory class. There you can either call the original 
implementation and then configure the connection as needed (e.g.,
by executing some statements) or you can create a completely custom
PostgreSQL connection and pass the handle to the connection's class
constructor. See this post for details:

http://www.codesynthesis.com/pipermail/odb-users/2012-January/000425.html

Boris



More information about the odb-users mailing list