Skip to content

Commit

Permalink
Remove error context handling from string literal hook
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Kasko <[email protected]>
  • Loading branch information
staticlibs committed Jun 28, 2024
1 parent 88c8871 commit 8ce8520
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 1 addition & 3 deletions contrib/babelfishpg_tsql/src/pltsql_coerce.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ starts_with(const char *text, const char *pat)
}

static Node *
tsql_coerce_string_literal_hook(ParseCallbackState *pcbstate, Oid targetTypeId,
tsql_coerce_string_literal_hook(Oid targetTypeId,
int32 targetTypeMod, int32 baseTypeMod,
Const *newcon, char *value,
CoercionContext ccontext, CoercionForm cformat,
Expand Down Expand Up @@ -1149,8 +1149,6 @@ tsql_coerce_string_literal_hook(ParseCallbackState *pcbstate, Oid targetTypeId,
false));
errFunc = makeFuncExpr(errFuncOid, targetTypeId, args, 0, 0, COERCE_EXPLICIT_CALL);

cancel_parser_errposition_callback(pcbstate);

result = (Node *) errFunc;

/* If target is a domain, apply constraints. */
Expand Down
14 changes: 14 additions & 0 deletions test/JDBC/expected/babel_726.out
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,20 @@ x
~~END~~


-- check that duplicate view with varbinary cast does not cause crash (#2693)
create view babel_726_v1 as select cast('a' as varbinary)
go

create view babel_726_v1 as select cast('a' as varbinary)
go
~~ERROR (Code: 2714)~~

~~ERROR (Message: relation "babel_726_v1" already exists)~~


drop view babel_726_v1
go

drop table babel_726_t1
go

Expand Down
10 changes: 10 additions & 0 deletions test/JDBC/input/datatypes/babel_726.sql
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,16 @@ go
select coalesce(CAST('x'AS VARBINARY), CAST('x' AS NVARCHAR(4000)), 'x')
go

-- check that duplicate view with varbinary cast does not cause crash (#2693)
create view babel_726_v1 as select cast('a' as varbinary)
go

create view babel_726_v1 as select cast('a' as varbinary)
go

drop view babel_726_v1
go

drop table babel_726_t1
go

Expand Down

0 comments on commit 8ce8520

Please sign in to comment.