Skip to content

Commit

Permalink
Skip coercion until hook in T-SQL
Browse files Browse the repository at this point in the history
Signed-off-by: Walt Boettge <[email protected]>
  • Loading branch information
wboettge committed Aug 9, 2023
1 parent 3219473 commit 77a5b98
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/backend/parser/analyze.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "parser/parse_relation.h"
#include "parser/parse_target.h"
#include "parser/parse_type.h"
#include "parser/parser.h"
#include "parser/parsetree.h"
#include "rewrite/rewriteManip.h"
#include "utils/backend_status.h"
Expand Down Expand Up @@ -2275,26 +2276,29 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
* it has to coerce the type, so failing now would just break
* cases that might work.
*/
if (lcoltype != UNKNOWNOID)
lcolnode = coerce_to_common_type(pstate, lcolnode,
rescoltype, context);
else if (IsA(lcolnode, Const) ||
IsA(lcolnode, Param))
if(sql_dialect != SQL_DIALECT_TSQL)
{
lcolnode = coerce_to_common_type(pstate, lcolnode,
rescoltype, context);
ltle->expr = (Expr *) lcolnode;
}
if (lcoltype != UNKNOWNOID)
lcolnode = coerce_to_common_type(pstate, lcolnode,
rescoltype, context);
else if (IsA(lcolnode, Const) ||
IsA(lcolnode, Param))
{
lcolnode = coerce_to_common_type(pstate, lcolnode,
rescoltype, context);
ltle->expr = (Expr *) lcolnode;
}

if (rcoltype != UNKNOWNOID)
rcolnode = coerce_to_common_type(pstate, rcolnode,
rescoltype, context);
else if (IsA(rcolnode, Const) ||
IsA(rcolnode, Param))
{
rcolnode = coerce_to_common_type(pstate, rcolnode,
rescoltype, context);
rtle->expr = (Expr *) rcolnode;
if (rcoltype != UNKNOWNOID)
rcolnode = coerce_to_common_type(pstate, rcolnode,
rescoltype, context);
else if (IsA(rcolnode, Const) ||
IsA(rcolnode, Param))
{
rcolnode = coerce_to_common_type(pstate, rcolnode,
rescoltype, context);
rtle->expr = (Expr *) rcolnode;
}
}

rescoltypmod = select_common_typmod(pstate,
Expand Down

0 comments on commit 77a5b98

Please sign in to comment.