diff --git a/CHANGES.txt b/CHANGES.txt index b550885257..98c183951e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.2.9 + * cqlsh COPY: unprotected pk values before converting them if not using prepared statements (CASSANDRA-12863) * Fix Util.spinAssertEquals (CASSANDRA-12283) * Fix potential NPE for compactionstats (CASSANDRA-12462) * Prepare legacy authenticate statement if credentials table initialised after node startup (CASSANDRA-12813) diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py index aee2920181..0c11636991 100644 --- a/pylib/cqlshlib/copyutil.py +++ b/pylib/cqlshlib/copyutil.py @@ -1778,15 +1778,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) @@ -2028,7 +2031,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