diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-05-28 13:50:48 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-05-28 13:50:48 +0000 |
| commit | 0512e625df45a9f7cb959bdf8b7aefb22893aeef (patch) | |
| tree | 9a6917e9897ddbcab5a7a1427ed3527562b0e6d3 /openstack | |
| parent | f6556a2032951954f5e3960041ed5e18c5f03679 (diff) | |
| parent | 3286ca90351d01b08aa6c66e8e3644fb1787a7fe (diff) | |
| download | oslo-0512e625df45a9f7cb959bdf8b7aefb22893aeef.tar.gz oslo-0512e625df45a9f7cb959bdf8b7aefb22893aeef.tar.xz oslo-0512e625df45a9f7cb959bdf8b7aefb22893aeef.zip | |
Merge "Changed processing unique constraint name."
Diffstat (limited to 'openstack')
| -rw-r--r-- | openstack/common/db/sqlalchemy/session.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/openstack/common/db/sqlalchemy/session.py b/openstack/common/db/sqlalchemy/session.py index ccce7d3..b96123a 100644 --- a/openstack/common/db/sqlalchemy/session.py +++ b/openstack/common/db/sqlalchemy/session.py @@ -412,14 +412,15 @@ def _raise_if_duplicate_entry_error(integrity_error, engine_name): """ def get_columns_from_uniq_cons_or_name(columns): - # note(boris-42): UniqueConstraint name convention: "uniq_c1_x_c2_x_c3" - # means that columns c1, c2, c3 are in UniqueConstraint. + # note(vsergeyev): UniqueConstraint name convention: "uniq_t$c1$c2" + # where `t` it is table name and columns `c1`, `c2` + # are in UniqueConstraint. uniqbase = "uniq_" if not columns.startswith(uniqbase): if engine_name == "postgresql": return [columns[columns.index("_") + 1:columns.rindex("_")]] return [columns] - return columns[len(uniqbase):].split("_x_") + return columns[len(uniqbase):].split("$")[1:] if engine_name not in ["mysql", "sqlite", "postgresql"]: return |
