diff --git a/contrib/babelfishpg_tsql/src/hooks.c b/contrib/babelfishpg_tsql/src/hooks.c index 1869184ab9..a970919bfd 100644 --- a/contrib/babelfishpg_tsql/src/hooks.c +++ b/contrib/babelfishpg_tsql/src/hooks.c @@ -211,7 +211,7 @@ static PlannedStmt *pltsql_planner_hook(Query *parse, const char *query_string, * parser Hook *****************************************/ static Oid set_param_collation(Param *param); -static Oid default_collation_for_builtin_type(Type typ, bool handle_text); +static Oid default_collation_for_builtin_type(Type typ); static char* pltsql_get_object_identity_event_trigger(ObjectAddress *addr); static const char *remove_db_name_in_schema(const char *schema_name, const char *object_type); @@ -5620,15 +5620,14 @@ set_param_collation(Param *param) * @return - default collation for the given builtin type based on dialect */ static Oid -default_collation_for_builtin_type(Type typ, bool handle_pg_type) +default_collation_for_builtin_type(Type typ) { Form_pg_type typtup; Oid oid = InvalidOid; typtup = (Form_pg_type) GETSTRUCT(typ); if (OidIsValid(typtup->typcollation) && - sql_dialect == SQL_DIALECT_TSQL && - (typtup->typnamespace == sys_schema_oid)) + sql_dialect == SQL_DIALECT_TSQL) { /* * Always set CLUSTER_COLLATION_OID() for babelfish collatable types so that @@ -5641,16 +5640,6 @@ default_collation_for_builtin_type(Type typ, bool handle_pg_type) oid = typtup->typcollation; } - /* - * Special handling for PG datatypes such as TEXT because Babelfish does not define sys.TEXT. - * This is required as Babelfish currently does not handle collation of String Const node correctly. - * TODO: Fix the handling of the collation for String Const node. - */ - if (handle_pg_type && oid == DEFAULT_COLLATION_OID) - { - oid = CLUSTER_COLLATION_OID(); - } - return oid; } diff --git a/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c b/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c index 65795b870b..87322870d1 100644 --- a/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c +++ b/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c @@ -2650,11 +2650,13 @@ get_coercion_expr(Node *arg, deparse_context *context, } else { - const char *dump_restore = GetConfigOption("babelfishpg_tsql.dump_restore", true, false); - if (!PRETTY_PAREN(context) && (!dump_restore || (dump_restore && strcmp(dump_restore, "on") != 0))) + // const char *dump_restore = GetConfigOption("babelfishpg_tsql.dump_restore", true, false); + // if (!PRETTY_PAREN(context) && (!dump_restore || (dump_restore && strcmp(dump_restore, "on") != 0))) + if (!PRETTY_PAREN(context)) appendStringInfoChar(buf, '('); get_rule_expr_paren(arg, context, false, parentNode); - if (!PRETTY_PAREN(context) && (!dump_restore || (dump_restore && strcmp(dump_restore, "on") != 0))) + // if (!PRETTY_PAREN(context) && (!dump_restore || (dump_restore && strcmp(dump_restore, "on") != 0))) + if (!PRETTY_PAREN(context)) appendStringInfoChar(buf, ')'); }