Re: Split copy.c - Mailing list pgsql-hackers

From Erik Rijkers
Subject Re: Split copy.c
Date
Msg-id 10917be6175bcede0873bbb1c572c875@xs4all.nl
Whole thread Raw
In response to Split copy.c  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: Split copy.c  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
On 2020-11-02 10:03, Heikki Linnakangas wrote:
> While looking at the parallel copy patches, it started to annoy me how
> large copy.c is. It confuses my little head. (Ok, it's annoyed me many
> times in the past, but I haven't done anything about it.)

> [0001-Split-copy.c-into-...o.c-and-copyfrom.c.patch]

There seems to be an oversight of contrib/file_fdw. (debian 10, gcc 
8.3.0)

After:

./configure  
--prefix=/home/aardvark/pg_stuff/pg_installations/pgsql.split_copy 
--bindir=/home/aardvark/pg_stuff/pg_installations/pgsql.split_copy/bin.fast 
--libdir=/home/aardvark/pg_stuff/pg_installations/pgsql.split_copy/lib.fast 
--with-pgport=6973 --quiet --enable-depend    --with-libxml 
--with-libxslt --with-zlib --with-openssl  --enable-tap-tests  
--with-extra-version=_split_copy_1102_90d8


... these errors+warnings from contrib/file_fdw:


-- [2020.11.02 10:31:53 split_copy/1] make contrib
file_fdw.c:108:2: error: unknown type name ‘CopyState’
   CopyState cstate;   /* COPY execution state */
   ^~~~~~~~~
file_fdw.c: In function ‘fileBeginForeignScan’:
file_fdw.c:658:2: error: unknown type name ‘CopyState’; did you mean 
‘CopyToState’?
   CopyState cstate;
   ^~~~~~~~~
   CopyToState
file_fdw.c:680:10: warning: passing argument 3 of ‘BeginCopyFrom’ from 
incompatible pointer type [-Wincompatible-pointer-types]
           filename,
           ^~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:60:76: note: expected ‘Node *’ {aka 
‘struct Node *’} but argument is of type ‘char *’
  extern CopyFromState BeginCopyFrom(ParseState *pstate, Relation rel, 
Node *whereClause,
                                                                       
~~~~~~^~~~~~~~~~~
file_fdw.c:681:10: error: incompatible type for argument 4 of 
‘BeginCopyFrom’
           is_program,
           ^~~~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:61:23: note: expected ‘const char *’ 
but argument is of type ‘_Bool’
            const char *filename,
            ~~~~~~~~~~~~^~~~~~~~
In file included from ../../src/include/access/tupdesc.h:19,
                  from ../../src/include/access/htup_details.h:19,
                  from file_fdw.c:18:
../../src/include/nodes/pg_list.h:65:19: warning: passing argument 6 of 
‘BeginCopyFrom’ from incompatible pointer type 
[-Wincompatible-pointer-types]
  #define NIL      ((List *) NULL)
                   ~^~~~~~~~~~~~~~
file_fdw.c:683:10: note: in expansion of macro ‘NIL’
           NIL,
           ^~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:62:48: note: expected 
‘copy_data_source_cb’ {aka ‘int (*)(void *, int,  int)’} but argument is 
of type ‘List *’ {aka ‘struct List *’}
            bool is_program, copy_data_source_cb data_source_cb, List 
*attnamelist, List *options);
                             ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
file_fdw.c:678:11: error: too few arguments to function ‘BeginCopyFrom’
   cstate = BeginCopyFrom(NULL,
            ^~~~~~~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:60:22: note: declared here
  extern CopyFromState BeginCopyFrom(ParseState *pstate, Relation rel, 
Node *whereClause,
                       ^~~~~~~~~~~~~
file_fdw.c: In function ‘fileIterateForeignScan’:
file_fdw.c:714:20: warning: cast to pointer from integer of different 
size [-Wint-to-pointer-cast]
   errcallback.arg = (void *) festate->cstate;
                     ^
file_fdw.c:731:30: warning: passing argument 1 of ‘NextCopyFrom’ makes 
pointer from integer without a cast [-Wint-conversion]
   found = NextCopyFrom(festate->cstate, NULL,
                        ~~~~~~~^~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:64:40: note: expected ‘CopyFromState’ 
{aka ‘struct CopyFromStateData *’} but argument is of type ‘int’
  extern bool NextCopyFrom(CopyFromState cstate, ExprContext *econtext,

                           ~~~~~~~~~~~~~~^~~~~~
file_fdw.c: In function ‘fileReScanForeignScan’:
file_fdw.c:751:21: warning: passing argument 1 of ‘EndCopyFrom’ makes 
pointer from integer without a cast [-Wint-conversion]
   EndCopyFrom(festate->cstate);
               ~~~~~~~^~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:63:39: note: expected ‘CopyFromState’ 
{aka ‘struct CopyFromStateData *’} but argument is of type ‘int’
  extern void EndCopyFrom(CopyFromState cstate);
                          ~~~~~~~~~~~~~~^~~~~~
file_fdw.c:755:17: warning: passing argument 3 of ‘BeginCopyFrom’ from 
incompatible pointer type [-Wincompatible-pointer-types]
           festate->filename,
           ~~~~~~~^~~~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:60:76: note: expected ‘Node *’ {aka 
‘struct Node *’} but argument is of type ‘char *’
  extern CopyFromState BeginCopyFrom(ParseState *pstate, Relation rel, 
Node *whereClause,
                                                                       
~~~~~~^~~~~~~~~~~
file_fdw.c:756:17: error: incompatible type for argument 4 of 
‘BeginCopyFrom’
           festate->is_program,
           ~~~~~~~^~~~~~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:61:23: note: expected ‘const char *’ 
but argument is of type ‘_Bool’
            const char *filename,
            ~~~~~~~~~~~~^~~~~~~~
In file included from ../../src/include/access/tupdesc.h:19,
                  from ../../src/include/access/htup_details.h:19,
                  from file_fdw.c:18:
../../src/include/nodes/pg_list.h:65:19: warning: passing argument 6 of 
‘BeginCopyFrom’ from incompatible pointer type 
[-Wincompatible-pointer-types]
  #define NIL      ((List *) NULL)
                   ~^~~~~~~~~~~~~~
file_fdw.c:758:10: note: in expansion of macro ‘NIL’
           NIL,
           ^~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:62:48: note: expected 
‘copy_data_source_cb’ {aka ‘int (*)(void *, int,  int)’} but argument is 
of type ‘List *’ {aka ‘struct List *’}
            bool is_program, copy_data_source_cb data_source_cb, List 
*attnamelist, List *options);
                             ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
file_fdw.c:753:20: error: too few arguments to function ‘BeginCopyFrom’
   festate->cstate = BeginCopyFrom(NULL,
                     ^~~~~~~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:60:22: note: declared here
  extern CopyFromState BeginCopyFrom(ParseState *pstate, Relation rel, 
Node *whereClause,
                       ^~~~~~~~~~~~~
file_fdw.c: In function ‘fileEndForeignScan’:
file_fdw.c:773:22: warning: passing argument 1 of ‘EndCopyFrom’ makes 
pointer from integer without a cast [-Wint-conversion]
    EndCopyFrom(festate->cstate);
                ~~~~~~~^~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:63:39: note: expected ‘CopyFromState’ 
{aka ‘struct CopyFromStateData *’} but argument is of type ‘int’
  extern void EndCopyFrom(CopyFromState cstate);
                          ~~~~~~~~~~~~~~^~~~~~
file_fdw.c: In function ‘file_acquire_sample_rows’:


file_fdw.c: In function ‘file_acquire_sample_rows’:
file_fdw.c:1110:2: error: unknown type name ‘CopyState’; did you mean 
‘CopyToState’?
   CopyState cstate;
   ^~~~~~~~~
   CopyToState
file_fdw.c:1128:39: warning: passing argument 3 of ‘BeginCopyFrom’ from 
incompatible pointer type [-Wincompatible-pointer-types]
   cstate = BeginCopyFrom(NULL, onerel, filename, is_program, NULL, NIL,
                                        ^~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:60:76: note: expected ‘Node *’ {aka 
‘struct Node *’} but argument is of type ‘char *’
  extern CopyFromState BeginCopyFrom(ParseState *pstate, Relation rel,
Node *whereClause,
                                                                       
~~~~~~^~~~~~~~~~~
file_fdw.c:1128:49: error: incompatible type for argument 4 of 
‘BeginCopyFrom’
   cstate = BeginCopyFrom(NULL, onerel, filename, is_program, NULL, NIL,
                                                  ^~~~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:61:23: note: expected ‘const char *’ 
but argument is of type ‘_Bool’
            const char *filename,
            ~~~~~~~~~~~~^~~~~~~~
In file included from ../../src/include/access/tupdesc.h:19,
                  from ../../src/include/access/htup_details.h:19,
                  from file_fdw.c:18:
../../src/include/nodes/pg_list.h:65:19: warning: passing argument 6 of 
‘BeginCopyFrom’ from incompatible pointer type 
[-Wincompatible-pointer-types]
  #define NIL      ((List *) NULL)
                   ~^~~~~~~~~~~~~~
file_fdw.c:1128:67: note: in expansion of macro ‘NIL’
   cstate = BeginCopyFrom(NULL, onerel, filename, is_program, NULL, NIL,
                                                                    ^~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:62:48: note: expected 
‘copy_data_source_cb’ {aka ‘int (*)(void *, int,  int)’} but argument is 
of type ‘List *’ {aka ‘struct List *’}
            bool is_program, copy_data_source_cb data_source_cb, List 
*attnamelist, List *options);
                             ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
file_fdw.c:1128:11: error: too few arguments to function ‘BeginCopyFrom’
   cstate = BeginCopyFrom(NULL, onerel, filename, is_program, NULL, NIL,
            ^~~~~~~~~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:60:22: note: declared here
  extern CopyFromState BeginCopyFrom(ParseState *pstate, Relation rel, 
Node *whereClause,
                       ^~~~~~~~~~~~~
file_fdw.c:1144:20: warning: cast to pointer from integer of different 
size [-Wint-to-pointer-cast]
   errcallback.arg = (void *) cstate;
                     ^
file_fdw.c:1159:24: warning: passing argument 1 of ‘NextCopyFrom’ makes 
pointer from integer without a cast [-Wint-conversion]
    found = NextCopyFrom(cstate, NULL, values, nulls);
                         ^~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:64:40: note: expected ‘CopyFromState’ 
{aka ‘struct CopyFromStateData *’} but argument is of type ‘int’
  extern bool NextCopyFrom(CopyFromState cstate, ExprContext *econtext,
                           ~~~~~~~~~~~~~~^~~~~~
file_fdw.c:1211:14: warning: passing argument 1 of ‘EndCopyFrom’ makes 
pointer from integer without a cast [-Wint-conversion]
   EndCopyFrom(cstate);
               ^~~~~~
In file included from file_fdw.c:24:
../../src/include/commands/copy.h:63:39: note: expected ‘CopyFromState’ 
{aka ‘struct CopyFromStateData *’} but argument is of type ‘int’
  extern void EndCopyFrom(CopyFromState cstate);
                          ~~~~~~~~~~~~~~^~~~~~
make[1]: *** [../../src/Makefile.global:921: file_fdw.o] Error 1
make: *** [Makefile:95: all-file_fdw-recurse] Error 2
-- contrib make returned 2 - abort





pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Collation versioning
Next
From: Anastasia Lubennikova
Date:
Subject: Re: Commitfest 2020-11