summaryrefslogtreecommitdiff
path: root/odb/relational/pgsql/schema.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/relational/pgsql/schema.cxx')
-rw-r--r--odb/relational/pgsql/schema.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/odb/relational/pgsql/schema.cxx b/odb/relational/pgsql/schema.cxx
index c774561..2113894 100644
--- a/odb/relational/pgsql/schema.cxx
+++ b/odb/relational/pgsql/schema.cxx
@@ -173,9 +173,13 @@ namespace relational
virtual string
name (sema_rel::index& in)
{
- // In PostgreSQL indexes cannot have a schema.
+ // In PostgreSQL, index names are database-global. Make them unique
+ // by prefixing the index name with table name. Note, however, that
+ // they cannot be qualified with the schema name.
//
- return quote_id (in.name ().uname ());
+ return quote_id (
+ static_cast<sema_rel::table&> (in.scope ()).name ().uname ()
+ + "_" + in.name ());
}
};
entry<create_index> create_index_;