Support testing float with PG 11 and earlier
authorChristoph Berg <[email protected]>
Thu, 14 Sep 2023 11:46:30 +0000 (13:46 +0200)
committerChristoph Berg <[email protected]>
Thu, 14 Sep 2023 11:46:30 +0000 (13:46 +0200)
See #9.

./workflows/ci.yml
Makefile
expected/datatypes.out
expected/datatypes_3.out
expected/float.out[new file with mode: 0644]
expected/float_1.out[new file with mode: 0644]
expected/float_3.out[new file with mode: 0644]
expected/float_4.out[new file with mode: 0644]
sql/datatypes.sql
sql/float.sql[new file with mode: 0644]

index d1b5b6d58786c6357751d8fc3ed86fe7a9a81571..a4a191b1af49857c276cf49783093cffa0eb6de9 100644 (file)
@@ -14,6 +14,8 @@ jobs:
           - 13
           - 12
           # versions before 12 have a different output format for floats (inf/Infinity, nan/NaN)
+          - 11
+          - 10
 
     name: 🐘 PostgreSQL ${{ matrix.pg }}
     runs-on: ubuntu-latest
@@ -23,7 +25,7 @@ jobs:
       - name: Start PostgreSQL ${{ matrix.pg }}
         run: pg-start ${{ matrix.pg }}
       - name: Check out the repo
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
       - name: Install extra build dependencies
         run: sudo apt-get install -y liblz4-dev
       - name: Build and test on PostgreSQL ${{ matrix.pg }}
index 83fe0a4b163ff12873c944c198cad1f9eb1ee154..2836eedfa655b46e2ab9384b0d4a343ec77b2390 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ FD_VERSION=14.1
 
 PROGRAM = pg_filedump
 OBJS = pg_filedump.o decode.o stringinfo.o
-REGRESS = datatypes numeric
+REGRESS = datatypes float numeric
 EXTRA_CLEAN = *.heap
 
 PG_CONFIG = pg_config
index 14be53771bfbab4bc66d06317a45de105b2c9778..3383ffa1c138fad647e62b566c9079dce567ffc5 100644 (file)
@@ -299,106 +299,6 @@ COPY: infinity
 COPY: \N
 
 
-*** End of File Encountered. Last Block Read: 0 ***
---
-----------------------------------------------------------------------------------------------
---
-create table float4 (x float4);
-insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
-\set relname float4
-\ir run_test.sql
-\echo Testing :relname
-Testing float4
-vacuum :"relname";
-checkpoint;
-select relfilenode from pg_class where relname = :'relname' \gset
-select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
-\set output :relname '.heap'
-\lo_export :oid :output
-\setenv relname :relname
-\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
-
-*******************************************************************
-* PostgreSQL File/Block Formatted Dump Utility
-*
-* File: float4.heap
-* Options used: -D float4
-*******************************************************************
-
-Block    0 ********************************************************
-<Header> -----
- Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
- Block: Size 8192  Version    4            Upper    8008 (0x1f48)
- LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
- Items:    6                      Free Space: 7960
- Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
- Length (including item array): 48
-
-<Data> -----
- Item   1 -- Length:   28  Offset: 8160 (0x1fe0)  Flags: NORMAL
-COPY: 0.000000000000
- Item   2 -- Length:   28  Offset: 8128 (0x1fc0)  Flags: NORMAL
-COPY: -0.000000000000
- Item   3 -- Length:   28  Offset: 8096 (0x1fa0)  Flags: NORMAL
-COPY: -Infinity
- Item   4 -- Length:   28  Offset: 8064 (0x1f80)  Flags: NORMAL
-COPY: Infinity
- Item   5 -- Length:   28  Offset: 8032 (0x1f60)  Flags: NORMAL
-COPY: NaN
- Item   6 -- Length:   24  Offset: 8008 (0x1f48)  Flags: NORMAL
-COPY: \N
-
-
-*** End of File Encountered. Last Block Read: 0 ***
---
-----------------------------------------------------------------------------------------------
---
-create table float8 (x float8);
-insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
-\set relname float8
-\ir run_test.sql
-\echo Testing :relname
-Testing float8
-vacuum :"relname";
-checkpoint;
-select relfilenode from pg_class where relname = :'relname' \gset
-select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
-\set output :relname '.heap'
-\lo_export :oid :output
-\setenv relname :relname
-\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
-
-*******************************************************************
-* PostgreSQL File/Block Formatted Dump Utility
-*
-* File: float8.heap
-* Options used: -D float8
-*******************************************************************
-
-Block    0 ********************************************************
-<Header> -----
- Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
- Block: Size 8192  Version    4            Upper    8008 (0x1f48)
- LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
- Items:    6                      Free Space: 7960
- Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
- Length (including item array): 48
-
-<Data> -----
- Item   1 -- Length:   32  Offset: 8160 (0x1fe0)  Flags: NORMAL
-COPY: 0.000000000000
- Item   2 -- Length:   32  Offset: 8128 (0x1fc0)  Flags: NORMAL
-COPY: -0.000000000000
- Item   3 -- Length:   32  Offset: 8096 (0x1fa0)  Flags: NORMAL
-COPY: -Infinity
- Item   4 -- Length:   32  Offset: 8064 (0x1f80)  Flags: NORMAL
-COPY: Infinity
- Item   5 -- Length:   32  Offset: 8032 (0x1f60)  Flags: NORMAL
-COPY: NaN
- Item   6 -- Length:   24  Offset: 8008 (0x1f48)  Flags: NORMAL
-COPY: \N
-
-
 *** End of File Encountered. Last Block Read: 0 ***
 --
 ----------------------------------------------------------------------------------------------
index 5b956fa72ca1065a24b0848b8a9d6158ae7fd767..00671278ad22024b5111eff7e44aba7ceb992396 100644 (file)
@@ -299,106 +299,6 @@ COPY: infinity
 COPY: \N
 
 
-*** End of File Encountered. Last Block Read: 0 ***
---
-----------------------------------------------------------------------------------------------
---
-create table float4 (x float4);
-insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
-\set relname float4
-\ir run_test.sql
-\echo Testing :relname
-Testing float4
-vacuum :"relname";
-checkpoint;
-select relfilenode from pg_class where relname = :'relname' \gset
-select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
-\set output :relname '.heap'
-\lo_export :oid :output
-\setenv relname :relname
-\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
-
-*******************************************************************
-* PostgreSQL File/Block Formatted Dump Utility
-*
-* File: float4.heap
-* Options used: -D float4
-*******************************************************************
-
-Block    0 ********************************************************
-<Header> -----
- Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
- Block: Size 8192  Version    4            Upper    8028 (0x1f5c)
- LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
- Items:    6                      Free Space: 7980
- Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
- Length (including item array): 48
-
-<Data> -----
- Item   1 -- Length:   28  Offset: 8164 (0x1fe4)  Flags: NORMAL
-COPY: 0.000000000000
- Item   2 -- Length:   28  Offset: 8136 (0x1fc8)  Flags: NORMAL
-COPY: -0.000000000000
- Item   3 -- Length:   28  Offset: 8108 (0x1fac)  Flags: NORMAL
-COPY: -Infinity
- Item   4 -- Length:   28  Offset: 8080 (0x1f90)  Flags: NORMAL
-COPY: Infinity
- Item   5 -- Length:   28  Offset: 8052 (0x1f74)  Flags: NORMAL
-COPY: NaN
- Item   6 -- Length:   24  Offset: 8028 (0x1f5c)  Flags: NORMAL
-COPY: \N
-
-
-*** End of File Encountered. Last Block Read: 0 ***
---
-----------------------------------------------------------------------------------------------
---
-create table float8 (x float8);
-insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
-\set relname float8
-\ir run_test.sql
-\echo Testing :relname
-Testing float8
-vacuum :"relname";
-checkpoint;
-select relfilenode from pg_class where relname = :'relname' \gset
-select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
-\set output :relname '.heap'
-\lo_export :oid :output
-\setenv relname :relname
-\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
-
-*******************************************************************
-* PostgreSQL File/Block Formatted Dump Utility
-*
-* File: float8.heap
-* Options used: -D float8
-*******************************************************************
-
-Block    0 ********************************************************
-<Header> -----
- Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
- Block: Size 8192  Version    4            Upper    8008 (0x1f48)
- LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
- Items:    6                      Free Space: 7960
- Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
- Length (including item array): 48
-
-<Data> -----
- Item   1 -- Length:   32  Offset: 8160 (0x1fe0)  Flags: NORMAL
-COPY: 0.000000000000
- Item   2 -- Length:   32  Offset: 8128 (0x1fc0)  Flags: NORMAL
-COPY: -0.000000000000
- Item   3 -- Length:   32  Offset: 8096 (0x1fa0)  Flags: NORMAL
-COPY: -Infinity
- Item   4 -- Length:   32  Offset: 8064 (0x1f80)  Flags: NORMAL
-COPY: Infinity
- Item   5 -- Length:   32  Offset: 8032 (0x1f60)  Flags: NORMAL
-COPY: NaN
- Item   6 -- Length:   24  Offset: 8008 (0x1f48)  Flags: NORMAL
-COPY: \N
-
-
 *** End of File Encountered. Last Block Read: 0 ***
 --
 ----------------------------------------------------------------------------------------------
diff --git a/expected/float.out b/expected/float.out
new file mode 100644 (file)
index 0000000..e3f54c0
--- /dev/null
@@ -0,0 +1,104 @@
+-- 64 bit output in *.out, 32 bit output in *_3.out
+-- PG12+ output in *.out/*_3.out, earlier in *_1.out/*_4.out
+select oid as datoid from pg_database where datname = current_database() \gset
+----------------------------------------------------------------------------------------------
+--
+create table float4 (x float4);
+insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
+\set relname float4
+\ir run_test.sql
+\echo Testing :relname
+Testing float4
+vacuum :"relname";
+checkpoint;
+select relfilenode from pg_class where relname = :'relname' \gset
+select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
+\set output :relname '.heap'
+\lo_export :oid :output
+\setenv relname :relname
+\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
+
+*******************************************************************
+* PostgreSQL File/Block Formatted Dump Utility
+*
+* File: float4.heap
+* Options used: -D float4
+*******************************************************************
+
+Block    0 ********************************************************
+<Header> -----
+ Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
+ Block: Size 8192  Version    4            Upper    8008 (0x1f48)
+ LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
+ Items:    6                      Free Space: 7960
+ Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
+ Length (including item array): 48
+
+<Data> -----
+ Item   1 -- Length:   28  Offset: 8160 (0x1fe0)  Flags: NORMAL
+COPY: 0.000000000000
+ Item   2 -- Length:   28  Offset: 8128 (0x1fc0)  Flags: NORMAL
+COPY: -0.000000000000
+ Item   3 -- Length:   28  Offset: 8096 (0x1fa0)  Flags: NORMAL
+COPY: -Infinity
+ Item   4 -- Length:   28  Offset: 8064 (0x1f80)  Flags: NORMAL
+COPY: Infinity
+ Item   5 -- Length:   28  Offset: 8032 (0x1f60)  Flags: NORMAL
+COPY: NaN
+ Item   6 -- Length:   24  Offset: 8008 (0x1f48)  Flags: NORMAL
+COPY: \N
+
+
+*** End of File Encountered. Last Block Read: 0 ***
+--
+----------------------------------------------------------------------------------------------
+--
+create table float8 (x float8);
+insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
+\set relname float8
+\ir run_test.sql
+\echo Testing :relname
+Testing float8
+vacuum :"relname";
+checkpoint;
+select relfilenode from pg_class where relname = :'relname' \gset
+select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
+\set output :relname '.heap'
+\lo_export :oid :output
+\setenv relname :relname
+\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
+
+*******************************************************************
+* PostgreSQL File/Block Formatted Dump Utility
+*
+* File: float8.heap
+* Options used: -D float8
+*******************************************************************
+
+Block    0 ********************************************************
+<Header> -----
+ Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
+ Block: Size 8192  Version    4            Upper    8008 (0x1f48)
+ LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
+ Items:    6                      Free Space: 7960
+ Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
+ Length (including item array): 48
+
+<Data> -----
+ Item   1 -- Length:   32  Offset: 8160 (0x1fe0)  Flags: NORMAL
+COPY: 0.000000000000
+ Item   2 -- Length:   32  Offset: 8128 (0x1fc0)  Flags: NORMAL
+COPY: -0.000000000000
+ Item   3 -- Length:   32  Offset: 8096 (0x1fa0)  Flags: NORMAL
+COPY: -Infinity
+ Item   4 -- Length:   32  Offset: 8064 (0x1f80)  Flags: NORMAL
+COPY: Infinity
+ Item   5 -- Length:   32  Offset: 8032 (0x1f60)  Flags: NORMAL
+COPY: NaN
+ Item   6 -- Length:   24  Offset: 8008 (0x1f48)  Flags: NORMAL
+COPY: \N
+
+
+*** End of File Encountered. Last Block Read: 0 ***
+--
+----------------------------------------------------------------------------------------------
diff --git a/expected/float_1.out b/expected/float_1.out
new file mode 100644 (file)
index 0000000..f64a058
--- /dev/null
@@ -0,0 +1,104 @@
+-- 64 bit output in *.out, 32 bit output in *_3.out
+-- PG12+ output in *.out/*_3.out, earlier in *_1.out/*_4.out
+select oid as datoid from pg_database where datname = current_database() \gset
+----------------------------------------------------------------------------------------------
+create table float4 (x float4);
+insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
+\set relname float4
+\ir run_test.sql
+\echo Testing :relname
+Testing float4
+vacuum :"relname";
+checkpoint;
+select relfilenode from pg_class where relname = :'relname' \gset
+select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
+\set output :relname '.heap'
+\lo_export :oid :output
+\setenv relname :relname
+\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
+
+*******************************************************************
+* PostgreSQL File/Block Formatted Dump Utility
+*
+* File: float4.heap
+* Options used: -D float4
+*******************************************************************
+
+Block    0 ********************************************************
+<Header> -----
+ Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
+ Block: Size 8192  Version    4            Upper    8008 (0x1f48)
+ LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
+ Items:    6                      Free Space: 7960
+ Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
+ Length (including item array): 48
+
+<Data> -----
+ Item   1 -- Length:   28  Offset: 8160 (0x1fe0)  Flags: NORMAL
+COPY: 0.000000000000
+ Item   2 -- Length:   28  Offset: 8128 (0x1fc0)  Flags: NORMAL
+COPY: -0.000000000000
+ Item   3 -- Length:   28  Offset: 8096 (0x1fa0)  Flags: NORMAL
+COPY: -inf
+ Item   4 -- Length:   28  Offset: 8064 (0x1f80)  Flags: NORMAL
+COPY: inf
+ Item   5 -- Length:   28  Offset: 8032 (0x1f60)  Flags: NORMAL
+COPY: nan
+ Item   6 -- Length:   24  Offset: 8008 (0x1f48)  Flags: NORMAL
+COPY: \N
+
+
+*** End of File Encountered. Last Block Read: 0 ***
+--
+----------------------------------------------------------------------------------------------
+--
+create table float8 (x float8);
+insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
+\set relname float8
+\ir run_test.sql
+\echo Testing :relname
+Testing float8
+vacuum :"relname";
+checkpoint;
+select relfilenode from pg_class where relname = :'relname' \gset
+select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
+\set output :relname '.heap'
+\lo_export :oid :output
+\setenv relname :relname
+\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
+
+*******************************************************************
+* PostgreSQL File/Block Formatted Dump Utility
+*
+* File: float8.heap
+* Options used: -D float8
+*******************************************************************
+
+Block    0 ********************************************************
+<Header> -----
+ Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
+ Block: Size 8192  Version    4            Upper    8008 (0x1f48)
+ LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
+ Items:    6                      Free Space: 7960
+ Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
+ Length (including item array): 48
+
+<Data> -----
+ Item   1 -- Length:   32  Offset: 8160 (0x1fe0)  Flags: NORMAL
+COPY: 0.000000000000
+ Item   2 -- Length:   32  Offset: 8128 (0x1fc0)  Flags: NORMAL
+COPY: -0.000000000000
+ Item   3 -- Length:   32  Offset: 8096 (0x1fa0)  Flags: NORMAL
+COPY: -inf
+ Item   4 -- Length:   32  Offset: 8064 (0x1f80)  Flags: NORMAL
+COPY: inf
+ Item   5 -- Length:   32  Offset: 8032 (0x1f60)  Flags: NORMAL
+COPY: nan
+ Item   6 -- Length:   24  Offset: 8008 (0x1f48)  Flags: NORMAL
+COPY: \N
+
+
+*** End of File Encountered. Last Block Read: 0 ***
+--
+----------------------------------------------------------------------------------------------
+--
diff --git a/expected/float_3.out b/expected/float_3.out
new file mode 100644 (file)
index 0000000..441ebe8
--- /dev/null
@@ -0,0 +1,104 @@
+-- 64 bit output in *.out, 32 bit output in *_3.out
+-- PG12+ output in *.out/*_3.out, earlier in *_1.out/*_4.out
+select oid as datoid from pg_database where datname = current_database() \gset
+----------------------------------------------------------------------------------------------
+create table float4 (x float4);
+insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
+\set relname float4
+\ir run_test.sql
+\echo Testing :relname
+Testing float4
+vacuum :"relname";
+checkpoint;
+select relfilenode from pg_class where relname = :'relname' \gset
+select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
+\set output :relname '.heap'
+\lo_export :oid :output
+\setenv relname :relname
+\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
+
+*******************************************************************
+* PostgreSQL File/Block Formatted Dump Utility
+*
+* File: float4.heap
+* Options used: -D float4
+*******************************************************************
+
+Block    0 ********************************************************
+<Header> -----
+ Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
+ Block: Size 8192  Version    4            Upper    8028 (0x1f5c)
+ LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
+ Items:    6                      Free Space: 7980
+ Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
+ Length (including item array): 48
+
+<Data> -----
+ Item   1 -- Length:   28  Offset: 8164 (0x1fe4)  Flags: NORMAL
+COPY: 0.000000000000
+ Item   2 -- Length:   28  Offset: 8136 (0x1fc8)  Flags: NORMAL
+COPY: -0.000000000000
+ Item   3 -- Length:   28  Offset: 8108 (0x1fac)  Flags: NORMAL
+COPY: -Infinity
+ Item   4 -- Length:   28  Offset: 8080 (0x1f90)  Flags: NORMAL
+COPY: Infinity
+ Item   5 -- Length:   28  Offset: 8052 (0x1f74)  Flags: NORMAL
+COPY: NaN
+ Item   6 -- Length:   24  Offset: 8028 (0x1f5c)  Flags: NORMAL
+COPY: \N
+
+
+*** End of File Encountered. Last Block Read: 0 ***
+--
+----------------------------------------------------------------------------------------------
+--
+create table float8 (x float8);
+insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
+\set relname float8
+\ir run_test.sql
+\echo Testing :relname
+Testing float8
+vacuum :"relname";
+checkpoint;
+select relfilenode from pg_class where relname = :'relname' \gset
+select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
+\set output :relname '.heap'
+\lo_export :oid :output
+\setenv relname :relname
+\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
+
+*******************************************************************
+* PostgreSQL File/Block Formatted Dump Utility
+*
+* File: float8.heap
+* Options used: -D float8
+*******************************************************************
+
+Block    0 ********************************************************
+<Header> -----
+ Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
+ Block: Size 8192  Version    4            Upper    8008 (0x1f48)
+ LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
+ Items:    6                      Free Space: 7960
+ Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
+ Length (including item array): 48
+
+<Data> -----
+ Item   1 -- Length:   32  Offset: 8160 (0x1fe0)  Flags: NORMAL
+COPY: 0.000000000000
+ Item   2 -- Length:   32  Offset: 8128 (0x1fc0)  Flags: NORMAL
+COPY: -0.000000000000
+ Item   3 -- Length:   32  Offset: 8096 (0x1fa0)  Flags: NORMAL
+COPY: -Infinity
+ Item   4 -- Length:   32  Offset: 8064 (0x1f80)  Flags: NORMAL
+COPY: Infinity
+ Item   5 -- Length:   32  Offset: 8032 (0x1f60)  Flags: NORMAL
+COPY: NaN
+ Item   6 -- Length:   24  Offset: 8008 (0x1f48)  Flags: NORMAL
+COPY: \N
+
+
+*** End of File Encountered. Last Block Read: 0 ***
+--
+----------------------------------------------------------------------------------------------
+--
diff --git a/expected/float_4.out b/expected/float_4.out
new file mode 100644 (file)
index 0000000..731487a
--- /dev/null
@@ -0,0 +1,104 @@
+-- 64 bit output in *.out, 32 bit output in *_3.out
+-- PG12+ output in *.out/*_3.out, earlier in *_1.out/*_4.out
+select oid as datoid from pg_database where datname = current_database() \gset
+----------------------------------------------------------------------------------------------
+create table float4 (x float4);
+insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
+\set relname float4
+\ir run_test.sql
+\echo Testing :relname
+Testing float4
+vacuum :"relname";
+checkpoint;
+select relfilenode from pg_class where relname = :'relname' \gset
+select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
+\set output :relname '.heap'
+\lo_export :oid :output
+\setenv relname :relname
+\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
+
+*******************************************************************
+* PostgreSQL File/Block Formatted Dump Utility
+*
+* File: float4.heap
+* Options used: -D float4
+*******************************************************************
+
+Block    0 ********************************************************
+<Header> -----
+ Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
+ Block: Size 8192  Version    4            Upper    8028 (0x1f5c)
+ LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
+ Items:    6                      Free Space: 7980
+ Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
+ Length (including item array): 48
+
+<Data> -----
+ Item   1 -- Length:   28  Offset: 8164 (0x1fe4)  Flags: NORMAL
+COPY: 0.000000000000
+ Item   2 -- Length:   28  Offset: 8136 (0x1fc8)  Flags: NORMAL
+COPY: -0.000000000000
+ Item   3 -- Length:   28  Offset: 8108 (0x1fac)  Flags: NORMAL
+COPY: -inf
+ Item   4 -- Length:   28  Offset: 8080 (0x1f90)  Flags: NORMAL
+COPY: inf
+ Item   5 -- Length:   28  Offset: 8052 (0x1f74)  Flags: NORMAL
+COPY: nan
+ Item   6 -- Length:   24  Offset: 8028 (0x1f5c)  Flags: NORMAL
+COPY: \N
+
+
+*** End of File Encountered. Last Block Read: 0 ***
+--
+----------------------------------------------------------------------------------------------
+--
+create table float8 (x float8);
+insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
+\set relname float8
+\ir run_test.sql
+\echo Testing :relname
+Testing float8
+vacuum :"relname";
+checkpoint;
+select relfilenode from pg_class where relname = :'relname' \gset
+select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset
+\set output :relname '.heap'
+\lo_export :oid :output
+\setenv relname :relname
+\! pg_filedump -D $relname $relname.heap | sed -e "s/logid      ./logid      ./" -e "s/recoff 0x......../recoff 0x......../"
+
+*******************************************************************
+* PostgreSQL File/Block Formatted Dump Utility
+*
+* File: float8.heap
+* Options used: -D float8
+*******************************************************************
+
+Block    0 ********************************************************
+<Header> -----
+ Block Offset: 0x00000000         Offsets: Lower      48 (0x0030)
+ Block: Size 8192  Version    4            Upper    8008 (0x1f48)
+ LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
+ Items:    6                      Free Space: 7960
+ Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
+ Length (including item array): 48
+
+<Data> -----
+ Item   1 -- Length:   32  Offset: 8160 (0x1fe0)  Flags: NORMAL
+COPY: 0.000000000000
+ Item   2 -- Length:   32  Offset: 8128 (0x1fc0)  Flags: NORMAL
+COPY: -0.000000000000
+ Item   3 -- Length:   32  Offset: 8096 (0x1fa0)  Flags: NORMAL
+COPY: -inf
+ Item   4 -- Length:   32  Offset: 8064 (0x1f80)  Flags: NORMAL
+COPY: inf
+ Item   5 -- Length:   32  Offset: 8032 (0x1f60)  Flags: NORMAL
+COPY: nan
+ Item   6 -- Length:   24  Offset: 8008 (0x1f48)  Flags: NORMAL
+COPY: \N
+
+
+*** End of File Encountered. Last Block Read: 0 ***
+--
+----------------------------------------------------------------------------------------------
+--
index 4aa50d7277237cffe946f768e6ad068fe8914810..67dba3b0b992d65883e70af15ecbd34d69765d2f 100644 (file)
@@ -39,16 +39,6 @@ insert into date values ('2000-01-01'), ('1900-02-02'), ('2100-12-31'), ('100-01
 \set relname date
 \ir run_test.sql
 
-create table float4 (x float4);
-insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
-\set relname float4
-\ir run_test.sql
-
-create table float8 (x float8);
-insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
-\set relname float8
-\ir run_test.sql
-
 create table int (x int);
 insert into int values (-1), (0), (1), (null);
 \set relname int
diff --git a/sql/float.sql b/sql/float.sql
new file mode 100644 (file)
index 0000000..3c937b8
--- /dev/null
@@ -0,0 +1,16 @@
+-- 64 bit output in *.out, 32 bit output in *_3.out
+-- PG12+ output in *.out/*_3.out, earlier in *_1.out/*_4.out
+
+select oid as datoid from pg_database where datname = current_database() \gset
+
+----------------------------------------------------------------------------------------------
+
+create table float4 (x float4);
+insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
+\set relname float4
+\ir run_test.sql
+
+create table float8 (x float8);
+insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null);
+\set relname float8
+\ir run_test.sql