babelfish-for-postgresql / babelfish_extensions

Babelfish for PostgreSQL provides the capability for PostgreSQL to work with applications written for Microsoft SQL Server. Babelfish understands the SQL Server wire-protocol and T-SQL, the Microsoft SQL Server query and procedural language, so you don’t have to switch database drivers or rewrite all of your application queries.
https://babelfishpg.org/
Apache License 2.0
265 stars 88 forks source link

Wrong column type in sys.sql_modules #2617

Closed shalinilohia50 closed 1 month ago

shalinilohia50 commented 1 month ago

Description

Currently, definition column in the view sys.sql_modules stores upto 4000 characters. SSMS scripting uses sys.sql_modules view to show the definition of the procedure, and the procedure definition is truncated to 4000 characters if the actual procedure definition is more than 4K.

To avoid this incorrect definition, We can directly use sys.nvarchar and there is no need to specify the tymod of 4000 in case of sys.nvarchar for the definition column i.e., sys.nvarchar(4000).

Fixed the definition column for the views which should use nvarchar(max): sql_modules, system_sql_modules, all_sql_modules.

Issues Resolved

Task: BABEL-4870 Signed-off-by: Shalini Lohia lshalini@amazon.com

Test Scenarios Covered

coveralls commented 1 month ago

Pull Request Test Coverage Report for Build 9233588936

Details


Files with Coverage Reduction New Missed Lines %
contrib/babelfishpg_tds/src/backend/tds/tds_srv.c 1 89.15%
contrib/babelfishpg_tsql/src/collationproperty.c 1 92.86%
contrib/babelfishpg_tds/src/include/tds_request.h 1 73.8%
contrib/babelfishpg_common/src/encoding/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c 2 0.0%
contrib/babelfishpg_tds/src/backend/tds/err_handler.c 2 73.79%
contrib/babelfishpg_tsql/src/pl_comp-2.c 3 89.29%
contrib/babelfishpg_tsql/src/tsqlIface.hpp 3 84.21%
contrib/babelfishpg_tds/src/backend/tds/tdsprotocol.c 3 64.46%
contrib/babelfishpg_common/src/encoding/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c 4 0.0%
contrib/babelfishpg_common/src/encoding/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c 4 0.0%
<!-- Total: 21268 -->
Totals Coverage Status
Change from base Build 9225975685: -37.0%
Covered Lines: 20637
Relevant Lines: 57490

💛 - Coveralls