summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2022-01-28 09:22:53 +0100
committerPeter Eisentraut <peter@eisentraut.org>2022-01-28 09:44:47 +0100
commit43f33dc018a4b77ced78a0a6df8ed5d450cfe5f4 (patch)
treef372e2f7e3f37ee968c08f6cc6220b6657f90394 /src/test
parent5553cbd4fe3eb177b3266ca4a7e80159323608c2 (diff)
Add HEADER support to COPY text format
The COPY CSV format supports the HEADER option to output a header line. This patch adds the same option to the default text format. On input, the HEADER option causes the first line to be skipped, same as with CSV. Author: Rémi Lapeyre <remi.lapeyre@lenstra.fr> Discussion: https://www.postgresql.org/message-id/flat/CAF1-J-0PtCWMeLtswwGV2M70U26n4g33gpe1rcKQqe6wVQDrFA@mail.gmail.com
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/copy.out8
-rw-r--r--src/test/regress/sql/copy.sql12
2 files changed, 20 insertions, 0 deletions
diff --git a/src/test/regress/expected/copy.out b/src/test/regress/expected/copy.out
index 931e7b2e699..851b9a4a2d8 100644
--- a/src/test/regress/expected/copy.out
+++ b/src/test/regress/expected/copy.out
@@ -120,6 +120,14 @@ copy copytest3 to stdout csv header;
c1,"col with , comma","col with "" quote"
1,a,1
2,b,2
+create temp table copytest4 (
+ c1 int,
+ "colname with tab: " text);
+copy copytest4 from stdin (header);
+copy copytest4 to stdout (header);
+c1 colname with tab: \t
+1 a
+2 b
-- test copy from with a partitioned table
create table parted_copytest (
a int,
diff --git a/src/test/regress/sql/copy.sql b/src/test/regress/sql/copy.sql
index 15e26517ecb..016fedf6753 100644
--- a/src/test/regress/sql/copy.sql
+++ b/src/test/regress/sql/copy.sql
@@ -160,6 +160,18 @@ this is just a line full of junk that would error out if parsed
copy copytest3 to stdout csv header;
+create temp table copytest4 (
+ c1 int,
+ "colname with tab: " text);
+
+copy copytest4 from stdin (header);
+this is just a line full of junk that would error out if parsed
+1 a
+2 b
+\.
+
+copy copytest4 to stdout (header);
+
-- test copy from with a partitioned table
create table parted_copytest (
a int,