Changeset: 64517f8f4aab for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/64517f8f4aab
Added Files:
        sql/test/BugTracker-2026/Tests/8106-SQLSpecialColumns-overflow-bug.test
Modified Files:
        sql/test/BugTracker-2026/Tests/All
Branch: default
Log Message:

Add test for #8106


diffs (122 lines):

diff --git 
a/sql/test/BugTracker-2026/Tests/8106-SQLSpecialColumns-overflow-bug.test 
b/sql/test/BugTracker-2026/Tests/8106-SQLSpecialColumns-overflow-bug.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/8106-SQLSpecialColumns-overflow-bug.test
@@ -0,0 +1,108 @@
+statement ok
+CREATE TABLE t (
+    payload VARCHAR(2147483647)
+)
+
+-- 22003!overflow in conversion of 4294967294 to int.
+statement error 22003!overflow in conversion of 4294967294 to int.
+SELECT CAST(
+    CASE c.type
+        WHEN 'bigint' THEN 20
+        WHEN 'char' THEN 2 * c.type_digits
+        WHEN 'clob' THEN 2 * c.type_digits
+        WHEN 'date' THEN 10
+        WHEN 'day_interval' THEN 25
+        WHEN 'double' THEN 24
+        WHEN 'hugeint' THEN 40
+        WHEN 'int' THEN 11
+        WHEN 'json' THEN 2 * c.type_digits
+        WHEN 'real' THEN 14
+        WHEN 'smallint' THEN 6
+        WHEN 'time' THEN 12
+        WHEN 'timestamp' THEN 23
+        WHEN 'timestamptz' THEN 23
+        WHEN 'timetz' THEN 12
+        WHEN 'tinyint' THEN 4
+        WHEN 'url' THEN 2 * c.type_digits
+        WHEN 'uuid' THEN 36
+        WHEN 'varchar' THEN 2 * c.type_digits
+        WHEN 'xml' THEN 2 * c.type_digits
+        ELSE c.type_digits
+    END AS INTEGER
+) AS buffer_length
+FROM sys.columns AS c
+JOIN sys.tables AS t ON t.id = c.table_id
+JOIN sys.schemas AS s ON s.id = t.schema_id
+WHERE s.name = CURRENT_SCHEMA
+  AND t.name = 't'
+  AND c.name = 'payload'
+
+query I rowsort
+SELECT CAST(
+    CASE c.type
+        WHEN 'bigint' THEN 20
+        WHEN 'char' THEN c.type_digits
+        WHEN 'clob' THEN c.type_digits
+        WHEN 'date' THEN 10
+        WHEN 'day_interval' THEN 25
+        WHEN 'double' THEN 24
+        WHEN 'hugeint' THEN 40
+        WHEN 'int' THEN 11
+        WHEN 'json' THEN c.type_digits
+        WHEN 'real' THEN 14
+        WHEN 'smallint' THEN 6
+        WHEN 'time' THEN 12
+        WHEN 'timestamp' THEN 23
+        WHEN 'timestamptz' THEN 23
+        WHEN 'timetz' THEN 12
+        WHEN 'tinyint' THEN 4
+        WHEN 'url' THEN c.type_digits
+        WHEN 'uuid' THEN 36
+        WHEN 'varchar' THEN c.type_digits
+        WHEN 'xml' THEN c.type_digits
+        ELSE c.type_digits
+    END AS INTEGER
+) AS buffer_length
+FROM sys.columns AS c
+JOIN sys.tables AS t ON t.id = c.table_id
+JOIN sys.schemas AS s ON s.id = t.schema_id
+WHERE s.name = CURRENT_SCHEMA
+  AND t.name = 't'
+  AND c.name = 'payload'
+----
+2147483647
+
+query I rowsort
+SELECT CAST(
+    CASE c.type
+        WHEN 'bigint' THEN 20
+        WHEN 'date' THEN 10
+        WHEN 'day_interval' THEN 25
+        WHEN 'double' THEN 24
+        WHEN 'hugeint' THEN 40
+        WHEN 'int' THEN 11
+        WHEN 'real' THEN 14
+        WHEN 'smallint' THEN 6
+        WHEN 'time' THEN 12
+        WHEN 'timestamp' THEN 23
+        WHEN 'timestamptz' THEN 23
+        WHEN 'timetz' THEN 12
+        WHEN 'tinyint' THEN 4
+        WHEN 'uuid' THEN 36
+        ELSE ifthenelse(c.type in ('varchar','char','clob','json','url','xml'),
+                        ifthenelse(c.type_digits in (0, 2147483647), 
c.type_digits, c.type_digits +1),
+                        c.type_digits)
+    END AS INTEGER
+) AS buffer_length
+FROM sys.columns AS c
+JOIN sys.tables AS t ON t.id = c.table_id
+JOIN sys.schemas AS s ON s.id = t.schema_id
+WHERE s.name = CURRENT_SCHEMA
+  AND t.name = 't'
+  AND c.name = 'payload'
+----
+2147483647
+
+statement ok
+DROP TABLE t
+
diff --git a/sql/test/BugTracker-2026/Tests/All 
b/sql/test/BugTracker-2026/Tests/All
--- a/sql/test/BugTracker-2026/Tests/All
+++ b/sql/test/BugTracker-2026/Tests/All
@@ -247,4 +247,5 @@ KNOWNFAIL?8010-first_value-last_value-pa
 8095-double-negated-in
 8100-error-overflow
 8105-semijoin-compare-exp-optimization
+8106-SQLSpecialColumns-overflow-bug
 8108-rownumber-topn-equality
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to