agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Sutou Kouhei <kou@clear-code.com>
Cc: michael@paquier.xyz
Cc: pgsql-hackers@postgresql.org
Subject: Re: Make COPY format extendable: Extract COPY TO format implementations
Date: Thu, 21 Nov 2024 11:41:18 +0100
Message-ID: <202411211041.v25vlwo2uvjr@alvherre.pgsql> (raw)
In-Reply-To: <CAD21AoA1s0nzjGU9t3N_uNdg3SZeOxXyH3rQfxYFEN3Y7JrKRQ@mail.gmail.com>

I ran `make headerscheck` after these patches and it reported a few
problems:

/pgsql/source/master/src/tools/pginclude/headerscheck /pgsql/source/master /pgsql/build/master
In file included from /tmp/headerscheck.xdG40Y/test.c:2:
/pgsql/source/master/src/include/commands/copyapi.h:76:44: error: unknown type name ‘CopyFromState’; did you mean ‘CopyToState’?
   76 |         void            (*CopyFromInFunc) (CopyFromState cstate, Oid atttypid,
      |                                            ^~~~~~~~~~~~~
      |                                            CopyToState
/pgsql/source/master/src/include/commands/copyapi.h:87:43: error: unknown type name ‘CopyFromState’; did you mean ‘CopyToState’?
   87 |         void            (*CopyFromStart) (CopyFromState cstate, TupleDesc tupDesc);
      |                                           ^~~~~~~~~~~~~
      |                                           CopyToState
/pgsql/source/master/src/include/commands/copyapi.h:98:44: error: unknown type name ‘CopyFromState’; did you mean ‘CopyToState’?
   98 |         bool            (*CopyFromOneRow) (CopyFromState cstate, ExprContext *econtext,
      |                                            ^~~~~~~~~~~~~
      |                                            CopyToState
/pgsql/source/master/src/include/commands/copyapi.h:102:41: error: unknown type name ‘CopyFromState’; did you mean ‘CopyToState’?
  102 |         void            (*CopyFromEnd) (CopyFromState cstate);
      |                                         ^~~~~~~~~~~~~
      |                                         CopyToState
/pgsql/source/master/src/include/commands/copyapi.h:103:1: warning: no semicolon at end of struct or union
  103 | } CopyFromRoutine;
      | ^

I think the fix should be the attached.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"In Europe they call me Niklaus Wirth; in the US they call me Nickel's worth.
 That's because in Europe they call me by name, and in the US by value!"

Attachments:

  [text/x-diff] copy-headersfix.patch (2.2K, ../202411211041.v25vlwo2uvjr@alvherre.pgsql/2-copy-headersfix.patch)
  download | inline diff:
diff --git a/contrib/file_fdw/file_fdw.c b/contrib/file_fdw/file_fdw.c
index 9e2896f32ae..bac31315fcb 100644
--- a/contrib/file_fdw/file_fdw.c
+++ b/contrib/file_fdw/file_fdw.c
@@ -21,7 +21,6 @@
 #include "access/table.h"
 #include "catalog/pg_authid.h"
 #include "catalog/pg_foreign_table.h"
-#include "commands/copy.h"
 #include "commands/copyfrom_internal.h"
 #include "commands/defrem.h"
 #include "commands/explain.h"
diff --git a/src/backend/commands/copyfromparse.c b/src/backend/commands/copyfromparse.c
index 5416583e94d..f80bdd5ed4e 100644
--- a/src/backend/commands/copyfromparse.c
+++ b/src/backend/commands/copyfromparse.c
@@ -62,7 +62,6 @@
 #include <unistd.h>
 #include <sys/stat.h>
 
-#include "commands/copy.h"
 #include "commands/copyfrom_internal.h"
 #include "commands/progress.h"
 #include "executor/executor.h"
diff --git a/src/backend/commands/copyto.c b/src/backend/commands/copyto.c
index 73b9ca44577..345ba48c3f9 100644
--- a/src/backend/commands/copyto.c
+++ b/src/backend/commands/copyto.c
@@ -19,7 +19,6 @@
 #include <sys/stat.h>
 
 #include "access/tableam.h"
-#include "commands/copy.h"
 #include "commands/copyapi.h"
 #include "commands/progress.h"
 #include "executor/execdesc.h"
diff --git a/src/include/commands/copyapi.h b/src/include/commands/copyapi.h
index ff269def9dc..4c3413841ae 100644
--- a/src/include/commands/copyapi.h
+++ b/src/include/commands/copyapi.h
@@ -14,12 +14,10 @@
 #ifndef COPYAPI_H
 #define COPYAPI_H
 
+#include "commands/copy.h"
 #include "executor/tuptable.h"
 #include "nodes/execnodes.h"
 
-/* This is private in commands/copyto.c */
-typedef struct CopyToStateData *CopyToState;
-
 /*
  * API structure for a COPY TO format implementation.   Note this must be
  * allocated in a server-lifetime manner, typically as a static const struct.
diff --git a/src/include/commands/copyfrom_internal.h b/src/include/commands/copyfrom_internal.h
index 55fe24d7284..1ca058c6add 100644
--- a/src/include/commands/copyfrom_internal.h
+++ b/src/include/commands/copyfrom_internal.h
@@ -14,7 +14,6 @@
 #ifndef COPYFROM_INTERNAL_H
 #define COPYFROM_INTERNAL_H
 
-#include "commands/copy.h"
 #include "commands/copyapi.h"
 #include "commands/trigger.h"
 #include "nodes/miscnodes.h"

view thread (340+ messages)  latest in thread

Message-ID: <202411211041.v25vlwo2uvjr@alvherre.pgsql>
Permalink:  ../202411211041.v25vlwo2uvjr@alvherre.pgsql/
Also on:    postgresql.org/message-id/202411211041.v25vlwo2uvjr@alvherre.pgsql

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, sawada.mshk@gmail.com, kou@clear-code.com, michael@paquier.xyz
  Subject: Re: Make COPY format extendable: Extract COPY TO format implementations
  In-Reply-To: <202411211041.v25vlwo2uvjr@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox