diff options
| author | Victor Sergeyev <vsergeyev@mirantis.com> | 2013-06-07 17:38:05 +0300 |
|---|---|---|
| committer | Victor Sergeyev <vsergeyev@mirantis.com> | 2013-06-07 17:50:11 +0300 |
| commit | 30cb47ee205400787af8f7fb739e8b67edc16dd0 (patch) | |
| tree | 699e6eb27534cf7cca039c51d140be191694fe8f /openstack/common/db/sqlalchemy | |
| parent | 5ce33b2adcf2477fe1192d7061cf49a8ab1a44a2 (diff) | |
| download | oslo-30cb47ee205400787af8f7fb739e8b67edc16dd0.tar.gz oslo-30cb47ee205400787af8f7fb739e8b67edc16dd0.tar.xz oslo-30cb47ee205400787af8f7fb739e8b67edc16dd0.zip | |
Changed processing unique constraint name.
Mr. Devananda found that dollar sign can be used as special symbol in
various programming langugages and proposed to use `0` instead of `$`.
So unique constraint name convention was changed from "uniq_t$c1$c2$c3"
to "uniq_t0c10c20c3" where `0` it is delimiter, `t` it is table name and
columns `c1`, `c2`, `c3` are in UniqueConstraint.
Function `_raise_if_duplicate_entry_error()` modified respectively to
new unique constraint name convention.
Change-Id: I88208dc03b55bbbc709b18580048c008004c9fda
Diffstat (limited to 'openstack/common/db/sqlalchemy')
| -rw-r--r-- | openstack/common/db/sqlalchemy/session.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/openstack/common/db/sqlalchemy/session.py b/openstack/common/db/sqlalchemy/session.py index dbc0bc8..4394846 100644 --- a/openstack/common/db/sqlalchemy/session.py +++ b/openstack/common/db/sqlalchemy/session.py @@ -436,7 +436,7 @@ def _raise_if_duplicate_entry_error(integrity_error, engine_name): """ def get_columns_from_uniq_cons_or_name(columns): - # note(vsergeyev): UniqueConstraint name convention: "uniq_t$c1$c2" + # note(vsergeyev): UniqueConstraint name convention: "uniq_t0c10c2" # where `t` it is table name and columns `c1`, `c2` # are in UniqueConstraint. uniqbase = "uniq_" @@ -444,7 +444,7 @@ def _raise_if_duplicate_entry_error(integrity_error, engine_name): if engine_name == "postgresql": return [columns[columns.index("_") + 1:columns.rindex("_")]] return [columns] - return columns[len(uniqbase):].split("$")[1:] + return columns[len(uniqbase):].split("0")[1:] if engine_name not in ["mysql", "sqlite", "postgresql"]: return |
