Re: force_not_null option support for file_fdw - Mailing list pgsql-hackers

From Shigeru Hanada
Subject Re: force_not_null option support for file_fdw
Date
Msg-id 4E699DE6.8010606@gmail.com
Whole thread Raw
In response to Re: force_not_null option support for file_fdw  (Kohei Kaigai <Kohei.Kaigai@EMEA.NEC.COM>)
Responses Re: force_not_null option support for file_fdw
Re: force_not_null option support for file_fdw
List pgsql-hackers
Thanks for the review, Kaigai-san.

(2011/09/09 0:47), Kohei Kaigai wrote:
> I found one other point to be fixed:
> On get_force_not_null(), it makes a list of attribute names with force_not_null option.
>
> +       foreach (cell, options)
> +       {
> +           DefElem    *def = (DefElem *) lfirst(cell);
> +           const char *value = defGetString(def);
> +
> +           if (strcmp(def->defname, "force_not_null") == 0&&
> +               strcmp(value, "true") == 0)
> +           {
> +               columns = lappend(columns, makeString(NameStr(attr->attname)));
> +               elog(DEBUG1, "%s: force_not_null", NameStr(attr->attname));
> +           }
> +
> +       }
>
> makeString() does not copy the supplied string itself, so it is not preferable to reference
> NameStr(attr->attname) across ReleaseSysCache().
> I'd like to suggest to supply a copied attname using pstrdup for makeString

Oops, fixed.
[ I should check some of my projects for this issue... ]

Attached patch also includes some cosmetic changes such as removing
useless blank lines.

Regards,
--
Shigeru Hanada

Attachment

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: pg_last_xact_insert_timestamp
Next
From: Pavel Golub
Date:
Subject: Re: pg_dump.c