-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace varcharTypeName->typeOid with baseTypeId in tsql_coerce_strin…
…g_literal_hook() to get the correct typeId (#2235) Currently, in tsql_coerce_string_literal_hook(), we are using varcharTypeName->typeOid without actually being set. This leads to error while dumping objects containing cast from string literal to binary type during MVU. For example: -- T-SQL endpoint 1> create view babel_4475_v1 as select cast(cast('a' as binary(2)) as varchar(2)) 2> go -- PSQL endpoint jdbc_testdb=# select pg_catalog.pg_get_viewdef(oid, true) from pg_class where relname = 'babel_4475_v1'; ERROR: cache lookup failed for type 0 This same also being done during dump & restore. This commit aims to fix this issue by appropriately setting base type id in tsql_coerce_string_literal_hook. Task: BABEL-4688 Signed-off-by: Sai Rohan Basa <[email protected]>
- Loading branch information
1 parent
ee5e599
commit 16a43e5
Showing
9 changed files
with
112 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
drop view babel_4688_v1 | ||
go | ||
|
||
drop view babel_4688_v2 | ||
go | ||
|
||
drop view babel_4688_v3 | ||
go | ||
|
||
drop view babel_4688_v4 | ||
go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
create view babel_4688_v1 as select cast(cast('a' as binary(2)) as varchar(2)) | ||
go | ||
|
||
create view babel_4688_v2 as select cast(cast('a' as binary(2)) as pg_catalog.varchar(2)) | ||
go | ||
|
||
EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_rowversion', 'ignore'; | ||
go | ||
|
||
create view babel_4688_v3 as select cast(cast('ab' as rowversion) as varchar(2)) | ||
go | ||
|
||
create view babel_4688_v4 as select cast(cast('ab' as rowversion) as pg_catalog.varchar(2)) | ||
go | ||
|
||
EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_rowversion', 'strict'; | ||
go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
select * from babel_4688_v1 | ||
go | ||
~~START~~ | ||
varchar | ||
a | ||
~~END~~ | ||
|
||
|
||
select * from babel_4688_v2 | ||
go | ||
~~START~~ | ||
varchar | ||
a | ||
~~END~~ | ||
|
||
|
||
EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_rowversion', 'ignore'; | ||
go | ||
|
||
select * from babel_4688_v3 | ||
go | ||
~~START~~ | ||
varchar | ||
ab | ||
~~END~~ | ||
|
||
|
||
select * from babel_4688_v4 | ||
go | ||
~~START~~ | ||
varchar | ||
ab | ||
~~END~~ | ||
|
||
|
||
EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_rowversion', 'strict'; | ||
go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
drop view babel_4688_v1 | ||
go | ||
|
||
drop view babel_4688_v2 | ||
go | ||
|
||
drop view babel_4688_v3 | ||
go | ||
|
||
drop view babel_4688_v4 | ||
go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
create view babel_4688_v1 as select cast(cast('a' as binary(2)) as varchar(2)) | ||
go | ||
|
||
create view babel_4688_v2 as select cast(cast('a' as binary(2)) as pg_catalog.varchar(2)) | ||
go | ||
|
||
EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_rowversion', 'ignore'; | ||
go | ||
|
||
create view babel_4688_v3 as select cast(cast('ab' as rowversion) as varchar(2)) | ||
go | ||
|
||
create view babel_4688_v4 as select cast(cast('ab' as rowversion) as pg_catalog.varchar(2)) | ||
go | ||
|
||
EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_rowversion', 'strict'; | ||
go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
select * from babel_4688_v1 | ||
go | ||
|
||
select * from babel_4688_v2 | ||
go | ||
|
||
EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_rowversion', 'ignore'; | ||
go | ||
|
||
select * from babel_4688_v3 | ||
go | ||
|
||
select * from babel_4688_v4 | ||
go | ||
|
||
EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_rowversion', 'strict'; | ||
go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -419,3 +419,4 @@ BABEL-4231 | |
sys_asymmetric_keys | ||
sys_certificates | ||
sys_database_permissions | ||
babel-4688 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters