Re: Add support for DEFAULT specification in COPY FROM

2023-03-15 Thread Andrew Dunstan
On 2023-03-15 We 13:00, Alexander Lakhin wrote: Hello, 13.03.2023 17:15, Andrew Dunstan wrote: On 2022-12-02 Fr 09:11, Israel Barth Rubio wrote: Hello all, I'm submitting a new version of the patch. Instead of changing signature of several functions in order to use the defaults parameter,

Re: Add support for DEFAULT specification in COPY FROM

2023-03-15 Thread Andrew Dunstan
On 2023-03-15 We 13:00, Alexander Lakhin wrote: Hello, 13.03.2023 17:15, Andrew Dunstan wrote: On 2022-12-02 Fr 09:11, Israel Barth Rubio wrote: Hello all, I'm submitting a new version of the patch. Instead of changing signature of several functions in order to use the defaults parameter,

Re: Add support for DEFAULT specification in COPY FROM

2023-03-15 Thread Alexander Lakhin
Hello, 13.03.2023 17:15, Andrew Dunstan wrote: On 2022-12-02 Fr 09:11, Israel Barth Rubio wrote: Hello all, I'm submitting a new version of the patch. Instead of changing signature of several functions in order to use the defaults parameter, it is now storing that in the cstate structure,

Re: Add support for DEFAULT specification in COPY FROM

2023-03-13 Thread Andrew Dunstan
On 2022-12-02 Fr 09:11, Israel Barth Rubio wrote: Hello all, I'm submitting a new version of the patch. Instead of changing signature of several functions in order to use the defaults parameter, it is now storing that in the cstate structure, which is already passed to all functions that

Re: Add support for DEFAULT specification in COPY FROM

2023-01-09 Thread Andrew Dunstan
On 2022-12-02 Fr 09:11, Israel Barth Rubio wrote: > Hello all, > > I'm submitting a new version of the patch. Instead of changing signature > of several functions in order to use the defaults parameter, it is now > storing > that in the cstate structure, which is already passed to all functions

Re: Add support for DEFAULT specification in COPY FROM

2022-12-02 Thread Israel Barth Rubio
Hello all, I'm submitting a new version of the patch. Instead of changing signature of several functions in order to use the defaults parameter, it is now storing that in the cstate structure, which is already passed to all functions that were previously modified. Best regards, Israel. Em sex.,

Re: Add support for DEFAULT specification in COPY FROM

2022-10-07 Thread Israel Barth Rubio
Hello Zhihong, > For the last question, please take a look at: > > #define MemSetAligned(start, val, len) \ > > which is called by palloc0(). Oh, I totally missed that. Thanks for the heads up! I'm attaching the new patch version, which contains both the fix to the problem reported by Andres,

Re: Add support for DEFAULT specification in COPY FROM

2022-10-07 Thread Israel Barth Rubio
Hello Andres, > cfbot shows that tests started failing with this version: > https://cirrus-ci.com/github/postgresql-cfbot/postgresql/commitfest/39/3822 > A full backtrace is at https://api.cirrus-ci.com/v1/task/5354378189078528/logs/cores.log Thanks for pointing this out. I had initially missed

Re: Add support for DEFAULT specification in COPY FROM

2022-10-07 Thread Zhihong Yu
On Fri, Oct 7, 2022 at 12:09 PM Israel Barth Rubio wrote: > Hello Zhihong, > > > + /* attribute is NOT to be copied from input */ > > > > I think saying `is NOT copied from input` should suffice. > > > > + /* fieldno is 0-index and attnum is 1-index */ > > > > 0-index ->

Re: Add support for DEFAULT specification in COPY FROM

2022-10-07 Thread Israel Barth Rubio
Hello Zhihong, > + /* attribute is NOT to be copied from input */ > > I think saying `is NOT copied from input` should suffice. > > + /* fieldno is 0-index and attnum is 1-index */ > > 0-index -> 0-indexed I have applied both suggestions, thanks! I'll submit a 4th version

Re: Add support for DEFAULT specification in COPY FROM

2022-10-02 Thread Andres Freund
Hi, On 2022-09-26 12:12:15 -0300, Israel Barth Rubio wrote: > Thanks for your review! I have applied the suggested changes, and I'm > submitting the new patch version. cfbot shows that tests started failing with this version:

Re: Add support for DEFAULT specification in COPY FROM

2022-09-26 Thread Zhihong Yu
On Mon, Sep 26, 2022 at 8:12 AM Israel Barth Rubio wrote: > Hello Andrew, > > > . There needs to be a check that this is being used with COPY FROM, and > > the restriction needs to be stated in the docs and tested for. c.f. > > FORCE NULL. > > > > . There needs to be support for this in psql's

Re: Add support for DEFAULT specification in COPY FROM

2022-09-26 Thread Israel Barth Rubio
Hello Andrew, > . There needs to be a check that this is being used with COPY FROM, and > the restriction needs to be stated in the docs and tested for. c.f. > FORCE NULL. > > . There needs to be support for this in psql's tab_complete.c, and > appropriate tests added > > . There needs to be

Re: Add support for DEFAULT specification in COPY FROM

2022-09-14 Thread Andrew Dunstan
On 2022-08-17 We 17:12, Israel Barth Rubio wrote: > Hello Andrew, > > Thanks for reviewing this patch [...] > > I am attaching the new patch, containing the above test in the regress > suite. > Thanks, this looks good but there are some things that need attention: . There needs to be a check

Re: Add support for DEFAULT specification in COPY FROM

2022-08-18 Thread Andrew Dunstan
On 2022-08-18 Th 05:55, Dagfinn Ilmari Mannsåker wrote: > Andrew Dunstan writes: > >> On 2022-08-16 Tu 14:12, Israel Barth Rubio wrote: >>> Hello all, >>> >>> With the current implementation of COPY FROM in PostgreSQL we are >>> able to load the DEFAULT value/expression of a column if the

Re: Add support for DEFAULT specification in COPY FROM

2022-08-18 Thread Israel Barth Rubio
Hello Ilmari, Thanks for checking it, too. I can study to implement these changes to include a way of overriding the behavior for the given columns. Regards, Israel. Em qui., 18 de ago. de 2022 às 06:56, Dagfinn Ilmari Mannsåker < ilm...@ilmari.org> escreveu: > Andrew Dunstan writes: > > > On

Re: Add support for DEFAULT specification in COPY FROM

2022-08-18 Thread Israel Barth Rubio
Hello, Thanks for your review. I submitted the patch to the next commit fest (https://commitfest.postgresql.org/39/3822/). Regards, Israel. Em qua., 17 de ago. de 2022 às 18:56, Andrew Dunstan escreveu: > > On 2022-08-17 We 17:12, Israel Barth Rubio wrote: > > > > > > Does that address your

Re: Add support for DEFAULT specification in COPY FROM

2022-08-18 Thread Dagfinn Ilmari Mannsåker
Andrew Dunstan writes: > On 2022-08-16 Tu 14:12, Israel Barth Rubio wrote: >> Hello all, >> >> With the current implementation of COPY FROM in PostgreSQL we are >> able to load the DEFAULT value/expression of a column if the column >> is absent in the list of specified columns. We are not able

Re: Add support for DEFAULT specification in COPY FROM

2022-08-17 Thread Andrew Dunstan
On 2022-08-17 We 17:12, Israel Barth Rubio wrote: > > > Does that address your concerns? > > I am attaching the new patch, containing the above test in the regress > suite. Thanks, yes, that all looks sane. Please add this to the next CommitFest if you haven't already done so. cheers

Re: Add support for DEFAULT specification in COPY FROM

2022-08-17 Thread Israel Barth Rubio
Hello Andrew, Thanks for reviewing this patch. It is worth noting that DEFAULT will only take place if explicitly specified, meaning there is no default value for the option DEFAULT. The usage of \D in the tests was only a suggestion. Also, NULL marker will be an unquoted empty string by default

Re: Add support for DEFAULT specification in COPY FROM

2022-08-16 Thread Andrew Dunstan
On 2022-08-16 Tu 14:12, Israel Barth Rubio wrote: > Hello all, > > With the current implementation of COPY FROM in PostgreSQL we are able to > load the DEFAULT value/expression of a column if the column is absent > in the > list of specified columns. We are not able to explicitly ask that >

Add support for DEFAULT specification in COPY FROM

2022-08-16 Thread Israel Barth Rubio
Hello all, With the current implementation of COPY FROM in PostgreSQL we are able to load the DEFAULT value/expression of a column if the column is absent in the list of specified columns. We are not able to explicitly ask that PostgreSQL uses the DEFAULT value/expression in a column that is