diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-07-20 14:26:23 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-07-27 10:30:15 +0200 |
commit | adfa9bbd04cd3571932ee7675344ca723bfa1eab (patch) | |
tree | c47487e8253d71ce0f2dd2e360f872e1e59a6cef /odb/relational/pgsql/schema.cxx | |
parent | 526f66e63f23afb40cc01550ca1a3a3592a84254 (diff) |
Move indexes from model scope to table scope
Conceptually, indexes belong to tables and some databases (MySQL, MSSQL)
indeed treat them as such (i.e., you can have indexes with the same name
in different tables).
Diffstat (limited to 'odb/relational/pgsql/schema.cxx')
-rw-r--r-- | odb/relational/pgsql/schema.cxx | 8 |
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_; |