Re: [feature]COPY FROM enable FORCE_NULL/FORCE_NOT_NULL on all columns - Mailing list pgsql-hackers

From Damir Belyalov
Subject Re: [feature]COPY FROM enable FORCE_NULL/FORCE_NOT_NULL on all columns
Date
Msg-id CALH1LgurdKw6H0mDDLopX2eymyEW7EwZfsbAT6909JQ2Daf3Lw@mail.gmail.com
Whole thread Raw
In response to Re: [feature]COPY FROM enable FORCE_NULL/FORCE_NOT_NULL on all columns  (Zhang Mingli <zmlpostgres@gmail.com>)
Responses Re: [feature]COPY FROM enable FORCE_NULL/FORCE_NOT_NULL on all columns  (Zhang Mingli <zmlpostgres@gmail.com>)
List pgsql-hackers
Hello!

The patch does not work for the current version of postgres, it needs to be updated.
I tested your patch. Everything looks simple and works well.

There is a suggestion to simplify the code: instead of using

if (cstate->opts.force_notnull_all)
{
int i;
for(i = 0; i < num_phys_attrs; i++)
cstate->opt.force_notnull_flags[i] = true;
}

you can use MemSet():

if (cstate->opts.force_notnull_all)
MemSet(cstate->opt.force_notnull_flags, true, num_phys_attrs * sizeof(bool));

The same for the force_null case.

Regards,
Damir Belyalov,
Postgres Professional

pgsql-hackers by date:

Previous
From: Matthias van de Meent
Date:
Subject: Re: Disabling Heap-Only Tuples
Next
From: Tomas Vondra
Date:
Subject: Re: Disabling Heap-Only Tuples