Skip to content

Commit

Permalink
Update test files.
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Teng <[email protected]>
  • Loading branch information
Jason Teng committed Sep 24, 2024
1 parent e6fb744 commit 311ef86
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 48 deletions.
67 changes: 34 additions & 33 deletions test/JDBC/expected/temp_table.out
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ int#!#varchar#!#int
~~END~~


-- should throw error due to generated column
ALTER TABLE #t1 DROP COLUMN a
GO
~~ERROR (Code: 33557097)~~
Expand All @@ -64,6 +65,37 @@ int#!#varchar#!#int


-- BABEL-5273 ALTER COLUMN to another type
ALTER TABLE #t1 ALTER COLUMN b CHAR(5)
GO

INSERT INTO #t1 (b) VALUES ('hello')
GO
~~ROW COUNT: 1~~


SELECT * FROM #t1
GO
~~START~~
int#!#char#!#int
1#!#<NULL>#!#2
2#!#hello#!#3
~~END~~


-- should fail due to possible truncation
ALTER TABLE #t1 ALTER COLUMN b CHAR(4)
GO
~~ERROR (Code: 8152)~~

~~ERROR (Message: value too long for type character(4))~~


DELETE FROM #t1 WHERE b = 'hello'
GO
~~ROW COUNT: 1~~


-- try all other TSQL types
ALTER TABLE #t1 ALTER COLUMN b TINYINT
GO

Expand Down Expand Up @@ -166,13 +198,9 @@ GO
~~ERROR (Message: type "BINARY" does not exist)~~


-- should raise error due to incompatible types
-- TODO: should raise error due to incompatible types
ALTER TABLE #t1 ALTER COLUMN b VARBINARY
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: column "b" cannot be cast automatically to type varbinary)~~


-- should raise error due to incompatible types
ALTER TABLE #t1 ALTER COLUMN b IMAGE
Expand All @@ -182,7 +210,7 @@ GO
~~ERROR (Message: column "b" cannot be cast automatically to type image)~~


-- should raise error due to incompatible types
-- TODO: should raise error due to incompatible types
ALTER TABLE #t1 ALTER COLUMN b GEOGRAPHY
GO
~~ERROR (Code: 33557097)~~
Expand All @@ -206,31 +234,6 @@ GO
~~ERROR (Message: syntax error at or near "XML")~~


ALTER TABLE #t1 ALTER COLUMN b CHAR(5)
GO

INSERT INTO #t1 (b) VALUES ('hello')
GO
~~ROW COUNT: 1~~


SELECT * FROM #t1
GO
~~START~~
int#!#char#!#int
1#!#<NULL>#!#2
2#!#hello#!#3
~~END~~


-- should fail due to possible truncation
ALTER TABLE #t1 ALTER COLUMN b CHAR(4)
GO
~~ERROR (Code: 8152)~~

~~ERROR (Message: value too long for type character(4))~~


ALTER TABLE #t1 DROP COLUMN b
GO

Expand All @@ -239,7 +242,6 @@ GO
~~START~~
int#!#int
1#!#2
2#!#3
~~END~~


Expand All @@ -251,7 +253,6 @@ GO
~~START~~
int
1
2
~~END~~


Expand Down
35 changes: 20 additions & 15 deletions test/JDBC/input/temp_tables/temp_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,31 @@ GO
SELECT * FROM #t1
GO

-- should throw error due to generated column
ALTER TABLE #t1 DROP COLUMN a
GO

SELECT * FROM #t1
GO

-- BABEL-5273 ALTER COLUMN to another type
ALTER TABLE #t1 ALTER COLUMN b CHAR(5)
GO

INSERT INTO #t1 (b) VALUES ('hello')
GO

SELECT * FROM #t1
GO

-- should fail due to possible truncation
ALTER TABLE #t1 ALTER COLUMN b CHAR(4)
GO

DELETE FROM #t1 WHERE b = 'hello'
GO

-- try all other TSQL types
ALTER TABLE #t1 ALTER COLUMN b TINYINT
GO

Expand Down Expand Up @@ -111,15 +129,15 @@ GO
ALTER TABLE #t1 ALTER COLUMN b BINARY
GO

-- should raise error due to incompatible types
-- TODO: should raise error due to incompatible types
ALTER TABLE #t1 ALTER COLUMN b VARBINARY
GO

-- should raise error due to incompatible types
ALTER TABLE #t1 ALTER COLUMN b IMAGE
GO

-- should raise error due to incompatible types
-- TODO: should raise error due to incompatible types
ALTER TABLE #t1 ALTER COLUMN b GEOGRAPHY
GO

Expand All @@ -131,19 +149,6 @@ GO
ALTER TABLE #t1 ALTER COLUMN b XML
GO

ALTER TABLE #t1 ALTER COLUMN b CHAR(5)
GO

INSERT INTO #t1 (b) VALUES ('hello')
GO

SELECT * FROM #t1
GO

-- should fail due to possible truncation
ALTER TABLE #t1 ALTER COLUMN b CHAR(4)
GO

ALTER TABLE #t1 DROP COLUMN b
GO

Expand Down

0 comments on commit 311ef86

Please sign in to comment.