Support testing against servers compiled without --with-libxml support
authorChristoph Berg <[email protected]>
Thu, 14 Sep 2023 11:56:33 +0000 (13:56 +0200)
committerChristoph Berg <[email protected]>
Thu, 14 Sep 2023 11:56:33 +0000 (13:56 +0200)
See #9.

Makefile
expected/datatypes.out
expected/datatypes_3.out
expected/xml.out[new file with mode: 0644]
expected/xml_1.out[new file with mode: 0644]
expected/xml_3.out[new file with mode: 0644]
sql/datatypes.sql
sql/xml.sql[new file with mode: 0644]

index 2836eedfa655b46e2ab9384b0d4a343ec77b2390..bc5094096901fc365d999097d5ec3649e129ce72 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 float numeric
+REGRESS = datatypes float numeric xml
 EXTRA_CLEAN = *.heap
 
 PG_CONFIG = pg_config
index 3383ffa1c138fad647e62b566c9079dce567ffc5..ff2aae26fabd141dc63238b53168e1461c12d6af 100644 (file)
@@ -981,48 +981,6 @@ COPY: 1
 COPY: \N
 
 
-*** End of File Encountered. Last Block Read: 0 ***
---
-----------------------------------------------------------------------------------------------
---
-create table xml (x xml);
-insert into xml values ('<xml></xml>'), (null);
-\set relname xml
-\ir run_test.sql
-\echo Testing :relname
-Testing xml
-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: xml.heap
-* Options used: -D xml
-*******************************************************************
-
-Block    0 ********************************************************
-<Header> -----
- Block Offset: 0x00000000         Offsets: Lower      32 (0x0020)
- Block: Size 8192  Version    4            Upper    8128 (0x1fc0)
- LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
- Items:    2                      Free Space: 8096
- Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
- Length (including item array): 32
-
-<Data> -----
- Item   1 -- Length:   36  Offset: 8152 (0x1fd8)  Flags: NORMAL
-COPY: <xml></xml>
- Item   2 -- Length:   24  Offset: 8128 (0x1fc0)  Flags: NORMAL
-COPY: \N
-
-
 *** End of File Encountered. Last Block Read: 0 ***
 --
 ----------------------------------------------------------------------------------------------
index 00671278ad22024b5111eff7e44aba7ceb992396..9620cea06b97431a98eca3afecc4963089badb41 100644 (file)
@@ -981,48 +981,6 @@ COPY: 1
 COPY: \N
 
 
-*** End of File Encountered. Last Block Read: 0 ***
---
-----------------------------------------------------------------------------------------------
---
-create table xml (x xml);
-insert into xml values ('<xml></xml>'), (null);
-\set relname xml
-\ir run_test.sql
-\echo Testing :relname
-Testing xml
-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: xml.heap
-* Options used: -D xml
-*******************************************************************
-
-Block    0 ********************************************************
-<Header> -----
- Block Offset: 0x00000000         Offsets: Lower      32 (0x0020)
- Block: Size 8192  Version    4            Upper    8132 (0x1fc4)
- LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
- Items:    2                      Free Space: 8100
- Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
- Length (including item array): 32
-
-<Data> -----
- Item   1 -- Length:   36  Offset: 8156 (0x1fdc)  Flags: NORMAL
-COPY: <xml></xml>
- Item   2 -- Length:   24  Offset: 8132 (0x1fc4)  Flags: NORMAL
-COPY: \N
-
-
 *** End of File Encountered. Last Block Read: 0 ***
 --
 ----------------------------------------------------------------------------------------------
diff --git a/expected/xml.out b/expected/xml.out
new file mode 100644 (file)
index 0000000..c7c1040
--- /dev/null
@@ -0,0 +1,46 @@
+-- 64 bit output in *.out, 32 bit output in *_3.out
+-- server without --with-libxml support output in *_1.out
+select oid as datoid from pg_database where datname = current_database() \gset
+----------------------------------------------------------------------------------------------
+create table xml (x xml);
+insert into xml values ('<xml></xml>'), (null);
+\set relname xml
+\ir run_test.sql
+\echo Testing :relname
+Testing xml
+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: xml.heap
+* Options used: -D xml
+*******************************************************************
+
+Block    0 ********************************************************
+<Header> -----
+ Block Offset: 0x00000000         Offsets: Lower      32 (0x0020)
+ Block: Size 8192  Version    4            Upper    8128 (0x1fc0)
+ LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
+ Items:    2                      Free Space: 8096
+ Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
+ Length (including item array): 32
+
+<Data> -----
+ Item   1 -- Length:   36  Offset: 8152 (0x1fd8)  Flags: NORMAL
+COPY: <xml></xml>
+ Item   2 -- Length:   24  Offset: 8128 (0x1fc0)  Flags: NORMAL
+COPY: \N
+
+
+*** End of File Encountered. Last Block Read: 0 ***
+--
+----------------------------------------------------------------------------------------------
+--
diff --git a/expected/xml_1.out b/expected/xml_1.out
new file mode 100644 (file)
index 0000000..2022565
--- /dev/null
@@ -0,0 +1,38 @@
+-- 64 bit output in *.out, 32 bit output in *_3.out
+-- server without --with-libxml support output in *_1.out
+select oid as datoid from pg_database where datname = current_database() \gset
+----------------------------------------------------------------------------------------------
+create table xml (x xml);
+insert into xml values ('<xml></xml>'), (null);
+ERROR:  unsupported XML feature
+LINE 1: insert into xml values ('<xml></xml>'), (null);
+                                ^
+DETAIL:  This functionality requires the server to be built with libxml support.
+HINT:  You need to rebuild PostgreSQL using --with-libxml.
+\set relname xml
+\ir run_test.sql
+\echo Testing :relname
+Testing xml
+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: xml.heap
+* Options used: -D xml
+*******************************************************************
+Error: Unable to read full page header from block 0.
+  ===> Read 0 bytes
+Notice: Block size determined from reading block 0 is zero, using default 8192 instead.
+Hint: Use -S <size> to specify the size manually.
+Error: Premature end of file encountered.
+--
+----------------------------------------------------------------------------------------------
+--
diff --git a/expected/xml_3.out b/expected/xml_3.out
new file mode 100644 (file)
index 0000000..fffda67
--- /dev/null
@@ -0,0 +1,46 @@
+-- 64 bit output in *.out, 32 bit output in *_3.out
+-- server without --with-libxml support output in *_1.out
+select oid as datoid from pg_database where datname = current_database() \gset
+----------------------------------------------------------------------------------------------
+create table xml (x xml);
+insert into xml values ('<xml></xml>'), (null);
+\set relname xml
+\ir run_test.sql
+\echo Testing :relname
+Testing xml
+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: xml.heap
+* Options used: -D xml
+*******************************************************************
+
+Block    0 ********************************************************
+<Header> -----
+ Block Offset: 0x00000000         Offsets: Lower      32 (0x0020)
+ Block: Size 8192  Version    4            Upper    8132 (0x1fc4)
+ LSN:  logid      . recoff 0x........      Special  8192 (0x2000)
+ Items:    2                      Free Space: 8100
+ Checksum: 0x0000  Prune XID: 0x00000000  Flags: 0x0004 (ALL_VISIBLE)
+ Length (including item array): 32
+
+<Data> -----
+ Item   1 -- Length:   36  Offset: 8156 (0x1fdc)  Flags: NORMAL
+COPY: <xml></xml>
+ Item   2 -- Length:   24  Offset: 8132 (0x1fc4)  Flags: NORMAL
+COPY: \N
+
+
+*** End of File Encountered. Last Block Read: 0 ***
+--
+----------------------------------------------------------------------------------------------
+--
index 67dba3b0b992d65883e70af15ecbd34d69765d2f..da2a0dc73b879477b0a779855a2d2142a6923564 100644 (file)
@@ -113,8 +113,3 @@ create table xid (x xid);
 insert into xid values ('-1'), ('0'), ('1'), (null);
 \set relname xid
 \ir run_test.sql
-
-create table xml (x xml);
-insert into xml values ('<xml></xml>'), (null);
-\set relname xml
-\ir run_test.sql
diff --git a/sql/xml.sql b/sql/xml.sql
new file mode 100644 (file)
index 0000000..a9de62f
--- /dev/null
@@ -0,0 +1,11 @@
+-- 64 bit output in *.out, 32 bit output in *_3.out
+-- server without --with-libxml support output in *_1.out
+
+select oid as datoid from pg_database where datname = current_database() \gset
+
+----------------------------------------------------------------------------------------------
+
+create table xml (x xml);
+insert into xml values ('<xml></xml>'), (null);
+\set relname xml
+\ir run_test.sql