This is an automated email from the ASF dual-hosted git repository. tuhaihe pushed a commit to branch add-behave-test-ci in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 9e97eb7db5352555eb83ac8cf3edfe1236d1fc21 Author: Dianjin Wang <[email protected]> AuthorDate: Fri Sep 11 14:45:09 2026 +0800 analyzedb: do not escape identifiers with pg.escape_string PyGreSQL's escape_string is a C function that encodes its argument as ASCII, so it raises UnicodeEncodeError on any table or schema name containing non-ASCII characters, and analyzedb exits with status 2 on a database it can otherwise analyze perfectly well. With standard_conforming_strings on -- the default -- doubling single quotes is the whole of the escaping a string literal needs, so build the literal directly. Exercised by the "analyzedb can handle the table name with special utf-8 characters" Behave scenario. --- gpMgmt/bin/analyzedb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gpMgmt/bin/analyzedb b/gpMgmt/bin/analyzedb index 48d8e16872c..d91cba85aab 100755 --- a/gpMgmt/bin/analyzedb +++ b/gpMgmt/bin/analyzedb @@ -982,7 +982,11 @@ def get_oid_str(table_list): def regclass_schema_tbl(schema, tbl): schema_tbl = "%s.%s" % (escape_identifier(schema), escape_identifier(tbl)) - return "to_regclass('%s')" % (pg.escape_string(schema_tbl)) + # Not pg.escape_string(): PyGreSQL's C implementation encodes its argument + # as ASCII and raises UnicodeEncodeError on a table or schema name that + # contains non-ASCII characters. With standard_conforming_strings on -- the + # default -- doubling single quotes is the whole of the escaping needed. + return "to_regclass('%s')" % schema_tbl.replace("'", "''") # Escape double-quotes in a string, so that the resulting string is suitable for --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
