diff --git a/CHANGES.txt b/CHANGES.txt index 7fd5101752..1b2b61f4da 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,7 +2,8 @@ * Fix CommitLogSegmentManagerTest (CASSANDRA-12283) * Pass root cause to CorruptBlockException when uncompression failed (CASSANDRA-12889) * Fix partition count log during compaction (CASSANDRA-12184) - +Merged from 2.2: +* cqlsh COPY: unprotected pk values before converting them if not using prepared statements (CASSANDRA-12863) 3.0.10 * Batch with multiple conditional updates for the same partition causes AssertionError (CASSANDRA-12867) diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py index d2084d7dff..a91b37af5f 100644 --- a/pylib/cqlshlib/copyutil.py +++ b/pylib/cqlshlib/copyutil.py @@ -1814,15 +1814,18 @@ class ImportConversion(object): where_clause) return parent.session.prepare(select_query) + @staticmethod + def unprotect(v): + if v is not None: + return CqlRuleSet.dequote_value(v) + def _get_converter(self, cql_type): """ Return a function that converts a string into a value the can be passed into BoundStatement.bind() for the given cql type. See cassandra.cqltypes for more details. """ - def unprotect(v): - if v is not None: - return CqlRuleSet.dequote_value(v) + unprotect = self.unprotect def convert(t, v): v = unprotect(v) @@ -2070,7 +2073,7 @@ class ImportConversion(object): return self.cqltypes[n].serialize(v, self.proto_version) def serialize_value_not_prepared(n, v): - return self.cqltypes[n].serialize(self.converters[n](v), self.proto_version) + return self.cqltypes[n].serialize(self.converters[n](self.unprotect(v)), self.proto_version) partition_key_indexes = self.partition_key_indexes serialize = serialize_value_prepared if self.use_prepared_statements else serialize_value_not_prepared