From 30cb47ee205400787af8f7fb739e8b67edc16dd0 Mon Sep 17 00:00:00 2001 From: Victor Sergeyev Date: Fri, 7 Jun 2013 17:38:05 +0300 Subject: 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 --- openstack/common/db/sqlalchemy/session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'openstack') 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 -- cgit