[odb-users] Different database schemas - postgresql

Konstantin Mikhailov ekimka at gmail.com
Tue Dec 13 07:05:50 EST 2011

Is it possible to specify different database schema
for different persistent objects/tables ? We need
simulanteous access to the tables located in the
different schemas.

I've tried to embed schema in the table name in the

#pragma db object table("myschema.test")
class Test {


    // ~~ Accessors

    int id() const throw() {
        return id_;

    void id(int id) {
        id_ = id;


    friend class odb::access;

    // ~~ Fields

    #pragma db id auto
    int id_;


But in *-odb.cxx i've got:

  const char access::object_traits< ::Test >::find_statement[] =
  " FROM \"myschema.test\""
  " WHERE \"myschema.test\".\"id\"=$1";

Unfortunatelly it will not work due to double quotes around
the table name.

More information about the odb-users mailing list