-
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.
Adding fix for edge cases in Space function (#2807)
* Adding fix for edge cases in Space function (#2742) Currently for string function SPACE() we only handle positive integers and throws error for input 0 or negative number. This commit will handle those edge cases and when a negative number is passed we will return NULL and when 0 is passed we will return an empty string. Additionally, this commit adds handling when input integer is greater than 8000. Task: BABEL-4811 Signed-off-by: Tanya Gupta <[email protected]>
- Loading branch information
1 parent
1596e1f
commit ad03399
Showing
34 changed files
with
734 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
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,50 @@ | ||
DROP FUNCTION babel_4811_vu_prepare_f1 | ||
GO | ||
|
||
DROP FUNCTION babel_4811_vu_prepare_f2 | ||
GO | ||
|
||
DROP FUNCTION babel_4811_vu_prepare_f3 | ||
GO | ||
|
||
DROP PROCEDURE babel_4811_vu_prepare_p1 | ||
GO | ||
|
||
DROP PROCEDURE babel_4811_vu_prepare_p2 | ||
GO | ||
|
||
DROP VIEW babel_4811_vu_prepare_v1 | ||
GO | ||
|
||
DROP VIEW babel_4811_vu_prepare_v2 | ||
GO | ||
|
||
DROP VIEW babel_4811_vu_prepare_v3 | ||
GO | ||
|
||
DROP VIEW babel_4811_vu_prepare_v4 | ||
GO | ||
|
||
DROP VIEW babel_4811_vu_prepare_v5 | ||
GO | ||
|
||
DROP VIEW babel_4811_vu_prepare_v6 | ||
GO | ||
|
||
DROP VIEW babel_4811_vu_prepare_v7 | ||
GO | ||
|
||
DROP VIEW babel_4811_vu_prepare_v8 | ||
GO | ||
|
||
DROP VIEW babel_4811_vu_prepare_v9 | ||
GO | ||
|
||
DROP TABLE babel_4811_vu_prepare_t1 | ||
GO | ||
|
||
DROP TABLE babel_4811_vu_prepare_t2 | ||
GO | ||
|
||
DROP TABLE babel_4811_vu_prepare_t3 | ||
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,91 @@ | ||
CREATE TABLE babel_4811_vu_prepare_t1(number int) | ||
GO | ||
INSERT INTO babel_4811_vu_prepare_t1 VALUES(5) | ||
GO | ||
~~ROW COUNT: 1~~ | ||
|
||
|
||
CREATE TABLE babel_4811_vu_prepare_t2(number int) | ||
GO | ||
INSERT INTO babel_4811_vu_prepare_t2 VALUES(-10) | ||
GO | ||
~~ROW COUNT: 1~~ | ||
|
||
|
||
CREATE TABLE babel_4811_vu_prepare_t3(number int) | ||
GO | ||
INSERT INTO babel_4811_vu_prepare_t3 VALUES(0) | ||
GO | ||
~~ROW COUNT: 1~~ | ||
|
||
|
||
CREATE FUNCTION babel_4811_vu_prepare_f1(@number int) | ||
returns int | ||
BEGIN | ||
RETURN DATALENGTH(SPACE(@number)) | ||
END | ||
GO | ||
|
||
CREATE FUNCTION babel_4811_vu_prepare_f2(@number int) | ||
returns varchar(20) | ||
BEGIN | ||
RETURN '|' + SPACE(@number) + '|' | ||
END | ||
GO | ||
|
||
CREATE FUNCTION babel_4811_vu_prepare_f3() | ||
returns table | ||
AS | ||
RETURN (select '|' + SPACE(number) + '|' as result from babel_4811_vu_prepare_t1) | ||
GO | ||
|
||
CREATE PROCEDURE babel_4811_vu_prepare_p1 (@number AS INT) | ||
AS | ||
BEGIN | ||
SELECT DATALENGTH(SPACE(@number)) | ||
END; | ||
GO | ||
|
||
CREATE PROCEDURE babel_4811_vu_prepare_p2 (@number AS INT) | ||
AS | ||
BEGIN | ||
SELECT '|' + SPACE(@number) + '|' AS result | ||
END; | ||
GO | ||
|
||
CREATE VIEW babel_4811_vu_prepare_v1 AS | ||
SELECT DATALENGTH(SPACE(10)) as result | ||
GO | ||
|
||
|
||
CREATE VIEW babel_4811_vu_prepare_v2 AS | ||
SELECT DATALENGTH(SPACE(0)) as result | ||
GO | ||
|
||
CREATE VIEW babel_4811_vu_prepare_v3 AS | ||
SELECT DATALENGTH(SPACE(-10)) as result | ||
GO | ||
|
||
CREATE VIEW babel_4811_vu_prepare_v4 AS | ||
SELECT DATALENGTH(SPACE(number)) as result FROM babel_4811_vu_prepare_t1 | ||
GO | ||
|
||
CREATE VIEW babel_4811_vu_prepare_v5 AS | ||
SELECT DATALENGTH(SPACE(number)) as result FROM babel_4811_vu_prepare_t2 | ||
GO | ||
|
||
CREATE VIEW babel_4811_vu_prepare_v6 AS | ||
SELECT DATALENGTH(SPACE(number)) as result FROM babel_4811_vu_prepare_t3 | ||
GO | ||
|
||
CREATE VIEW babel_4811_vu_prepare_v7 AS | ||
SELECT '|' + SPACE(10) + '|' AS result | ||
GO | ||
|
||
CREATE VIEW babel_4811_vu_prepare_v8 AS | ||
SELECT '|' + SPACE(0) + '|' AS result | ||
GO | ||
|
||
CREATE VIEW babel_4811_vu_prepare_v9 AS | ||
SELECT '|' + SPACE(-10) + '|' AS result | ||
GO |
Oops, something went wrong.