Re: Add header support to text format and matching feature - Mailing list pgsql-hackers

From vignesh C
Subject Re: Add header support to text format and matching feature
Date
Msg-id CALDaNm0zLTDKG6-85B-RKgAXmWiv8w7gDaSGKuQgiiZAS5N1Mw@mail.gmail.com
Whole thread Raw
In response to Re: Add header support to text format and matching feature  (Rémi Lapeyre <remi.lapeyre@lenstra.fr>)
Responses Re: Add header support to text format and matching feature
List pgsql-hackers
On Fri, Jul 17, 2020 at 10:18 PM Rémi Lapeyre <remi.lapeyre@lenstra.fr> wrote:
>
> >
> > I don't know how to do that with git-send-email, but you can certainly do it easy with git-format-patch and just
attachthem using your regular MUA. 
> >
> > (and while the cfbot and the archives have no problems dealing with the change in subject, it does break threading
insome other MUAs, so I would recommend not doing that and sticking to the existing subject of the thread) 
> >
>
> Thanks, here are both patches attached so cfbot can read them.

Few comments:
Few tests are failing because of hardcoded path:
+-- test header matching
+CREATE FOREIGN TABLE header_match ("1" int, foo text) SERVER file_server
+OPTIONS (format 'csv', filename
'/Users/remi/src/postgresql/contrib/file_fdw/data/list1.csv',
delimiter ',', header 'match');
+CREATE FOREIGN TABLE header_dont_match (a int, foo text) SERVER file_server
+OPTIONS (format 'csv', filename
'/Users/remi/src/postgresql/contrib/file_fdw/data/list1.csv',
delimiter ',', header 'match');  -- ERROR
Generally path is not specified like this. file_fdw test of make
check-world is failing because of this.

There is one warning present in the changes:
copy.c: In function ‘ProcessCopyOptions’:
copy.c:1208:5: warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
     char    *sval = defGetString(defel);

There is space before tab in indent in the below code, check for git
diff --check.
+                       if (fldct < list_length(cstate->attnumlist))
+                               ereport(ERROR,
+
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
+                                        errmsg("missing header")));

Regards,
Vignesh
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Added tab completion for the missing options in copy statement
Next
From: Chapman Flack
Date:
Subject: Re: pg_ctl behavior on Windows