launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03578
[Merge] lp:~stub/launchpad/bug-179821-lowercase-tablenames into lp:launchpad
Stuart Bishop has proposed merging lp:~stub/launchpad/bug-179821-lowercase-tablenames into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #179821 in Launchpad itself: "Case sensitive table names are not to be used"
https://bugs.launchpad.net/launchpad/+bug/179821
For more details, see:
https://code.launchpad.net/~stub/launchpad/bug-179821-lowercase-tablenames/+merge/60640
--
https://code.launchpad.net/~stub/launchpad/bug-179821-lowercase-tablenames/+merge/60640
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stub/launchpad/bug-179821-lowercase-tablenames into lp:launchpad.
=== modified file 'lib/canonical/database/ftests/test_multitablecopy.txt'
--- lib/canonical/database/ftests/test_multitablecopy.txt 2010-10-18 22:24:59 +0000
+++ lib/canonical/database/ftests/test_multitablecopy.txt 2011-05-11 14:50:31 +0000
@@ -39,6 +39,18 @@
>>> copier = MultiTableCopy('test', ['numeric', 'textual'],
... seconds_per_batch=0.1, minimum_batch_size=1)
+Note that the copier will not let us create tables with mixed case names.
+
+ >>> copier.getRawHoldingTableName('Foo')
+ Traceback (most recent call last):
+ ...
+ AssertionError: Unsupported characters in table name per Bug #179821
+
+ >>> copier.getRawHoldingTableName('foo', '-bar')
+ Traceback (most recent call last):
+ ...
+ AssertionError: Unsupported characters in table name per Bug #179821
+
=== Ordering ===
=== modified file 'lib/canonical/database/multitablecopy.py'
--- lib/canonical/database/multitablecopy.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/database/multitablecopy.py 2011-05-11 14:50:31 +0000
@@ -6,6 +6,7 @@
__all__ = [ 'MultiTableCopy' ]
import logging
+import re
import time
from zope.interface import implements
@@ -253,9 +254,15 @@
"""Name for a holding table, but without quotes. Use with care."""
if suffix:
suffix = '_%s' % suffix
- return "temp_%s_holding_%s%s" % (
+
+ assert re.search(r'[^a-z_]', tablename + suffix) is None, (
+ 'Unsupported characters in table name per Bug #179821')
+
+ raw_name = "temp_%s_holding_%s%s" % (
str(tablename), self.name, str(suffix))
+ return raw_name
+
def getHoldingTableName(self, tablename, suffix=''):
"""Name for a holding table to hold data being copied in tablename.
Follow ups