aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/expected/int2.out
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/expected/int2.out')
-rw-r--r--src/test/regress/expected/int2.out92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/test/regress/expected/int2.out b/src/test/regress/expected/int2.out
index 6a23567b679..08e2f9f9dca 100644
--- a/src/test/regress/expected/int2.out
+++ b/src/test/regress/expected/int2.out
@@ -329,3 +329,95 @@ FROM (VALUES (-2.5::numeric),
2.5 | 3
(7 rows)
+-- non-decimal literals
+SELECT int2 '0b100101';
+ int2
+------
+ 37
+(1 row)
+
+SELECT int2 '0o273';
+ int2
+------
+ 187
+(1 row)
+
+SELECT int2 '0x42F';
+ int2
+------
+ 1071
+(1 row)
+
+SELECT int2 '0b';
+ERROR: invalid input syntax for type smallint: "0b"
+LINE 1: SELECT int2 '0b';
+ ^
+SELECT int2 '0o';
+ERROR: invalid input syntax for type smallint: "0o"
+LINE 1: SELECT int2 '0o';
+ ^
+SELECT int2 '0x';
+ERROR: invalid input syntax for type smallint: "0x"
+LINE 1: SELECT int2 '0x';
+ ^
+-- cases near overflow
+SELECT int2 '0b111111111111111';
+ int2
+-------
+ 32767
+(1 row)
+
+SELECT int2 '0b1000000000000000';
+ERROR: value "0b1000000000000000" is out of range for type smallint
+LINE 1: SELECT int2 '0b1000000000000000';
+ ^
+SELECT int2 '0o77777';
+ int2
+-------
+ 32767
+(1 row)
+
+SELECT int2 '0o100000';
+ERROR: value "0o100000" is out of range for type smallint
+LINE 1: SELECT int2 '0o100000';
+ ^
+SELECT int2 '0x7FFF';
+ int2
+-------
+ 32767
+(1 row)
+
+SELECT int2 '0x8000';
+ERROR: value "0x8000" is out of range for type smallint
+LINE 1: SELECT int2 '0x8000';
+ ^
+SELECT int2 '-0b1000000000000000';
+ int2
+--------
+ -32768
+(1 row)
+
+SELECT int2 '-0b1000000000000001';
+ERROR: value "-0b1000000000000001" is out of range for type smallint
+LINE 1: SELECT int2 '-0b1000000000000001';
+ ^
+SELECT int2 '-0o100000';
+ int2
+--------
+ -32768
+(1 row)
+
+SELECT int2 '-0o100001';
+ERROR: value "-0o100001" is out of range for type smallint
+LINE 1: SELECT int2 '-0o100001';
+ ^
+SELECT int2 '-0x8000';
+ int2
+--------
+ -32768
+(1 row)
+
+SELECT int2 '-0x8001';
+ERROR: value "-0x8001" is out of range for type smallint
+LINE 1: SELECT int2 '-0x8001';
+ ^