Re: [PROPOSAL] : Disallow use of empty column name in (column_name '') in ALTER or CREATE of foreign table.

From: Nishant Sharma <nishant(dot)sharma(at)enterprisedb(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PROPOSAL] : Disallow use of empty column name in (column_name '') in ALTER or CREATE of foreign table.
Date: 2024-10-09 11:11:33
Message-ID: CADrsxdZgvOzAVX2PCpbXJiq3sLv7JF6NEwyvFE0K0HscR4z2Ug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 7, 2024 at 10:16 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Thu, Aug 22, 2024 at 04:00:13PM +0530, Nishant Sharma wrote:
> > I may be wrong, but just wanted to share my thoughts on the differences.
> > So, it
> > can be considered a different issue/mistake and can be handled
> separately in
> > another email thread.
>
> + else if (strcmp(def->defname, "column_name") == 0)
> + {
> + char *col_name_opt = defGetString(def);
> +
> + /*
> + * PostgresSQL follows SQL syntax, so we do not allow empty
> + * column_name option.
> + */
> + if (col_name_opt && col_name_opt[0] == '\0')
> + ereport(ERROR,
> + (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> + errmsg("colum_name option cannot be empty for
> postgres_fdw")));
> + }
>
> If we begin to care about empty names in column_name in the FDW
> command, shouldn't we also care about empry values in schema_name and
> table_name?
>
> Typos: PostgresSQL -> PostgreSQL and colum_name -> column_name.
>
> Once you associate table_name and schema_name, you can save in
> translation by rewording the errmsg like that (no need to mention
> postgres_fdw, note the quotes around the option name):
> errmsg("cannot use empty value for option \"%s\"",
> "column_name");
> --
> Michael
>

Thanks Michael for your review comments and response!

I have included them in v3. v3 does not allow empty schema_name &
table_name options along with column_name.

Thanks,
Nishant.

Attachment Content-Type Size
v3-0002-Test-Cases-Changes.patch application/octet-stream 4.2 KB
v3-0001-Disallow-empty-Foreign-Table-column-option-name-i.patch application/octet-stream 1.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2024-10-09 11:57:52 Re: [PATCH] Add some documentation on how to call internal functions
Previous Message Alvaro Herrera 2024-10-09 10:59:20 Re: overflow bug for inhcounts