Skip to content

Commit

Permalink
add float4 and float8 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tishj committed May 12, 2024
1 parent 16767ac commit b6a79e1
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
32 changes: 32 additions & 0 deletions expected/type_support.out
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,42 @@ SELECT * FROM timestamp_tbl;
Mon May 15 12:30:45 2023
(3 rows)

-- FLOAT4
CREATE TABLE float4_tbl(a FLOAT4);
INSERT INTO float4_tbl SELECT CAST(a AS FLOAT4) FROM (VALUES
(0.234234234::FLOAT4),
(NULL),
(458234502034234234234.000012::FLOAT4)
) t(a);
SELECT * FROM float4_tbl;
a
--------------
0.23423423

4.582345e+20
(3 rows)

-- FLOAT8
CREATE TABLE float8_tbl(a FLOAT8);
INSERT INTO float8_tbl SELECT CAST(a AS FLOAT8) FROM (VALUES
(0.234234234::FLOAT8),
(NULL),
(458234502034234234234.000012::FLOAT8)
) t(a);
SELECT * FROM float8_tbl;
a
-----------------------
0.234234234

4.582345020342342e+20
(3 rows)

DROP TABLE chr;
DROP TABLE small;
DROP TABLE intgr;
DROP TABLE big;
DROP TABLE varchar_tbl;
DROP TABLE date_tbl;
DROP TABLE timestamp_tbl;
DROP TABLE float4_tbl;
DROP TABLE float8_tbl;
20 changes: 20 additions & 0 deletions sql/type_support.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,30 @@ CREATE TABLE timestamp_tbl(a TIMESTAMP);
INSERT INTO timestamp_tbl SELECT CAST(a AS TIMESTAMP) FROM (VALUES ('2022-04-29 10:15:30'::TIMESTAMP), (NULL), ('2023-05-15 12:30:45'::TIMESTAMP)) t(a);
SELECT * FROM timestamp_tbl;

-- FLOAT4
CREATE TABLE float4_tbl(a FLOAT4);
INSERT INTO float4_tbl SELECT CAST(a AS FLOAT4) FROM (VALUES
(0.234234234::FLOAT4),
(NULL),
(458234502034234234234.000012::FLOAT4)
) t(a);
SELECT * FROM float4_tbl;

-- FLOAT8
CREATE TABLE float8_tbl(a FLOAT8);
INSERT INTO float8_tbl SELECT CAST(a AS FLOAT8) FROM (VALUES
(0.234234234::FLOAT8),
(NULL),
(458234502034234234234.000012::FLOAT8)
) t(a);
SELECT * FROM float8_tbl;

DROP TABLE chr;
DROP TABLE small;
DROP TABLE intgr;
DROP TABLE big;
DROP TABLE varchar_tbl;
DROP TABLE date_tbl;
DROP TABLE timestamp_tbl;
DROP TABLE float4_tbl;
DROP TABLE float8_tbl;

0 comments on commit b6a79e1

Please sign in to comment.