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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Nishant Sharma <nishant(dot)sharma(at)enterprisedb(dot)com>
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-07 04:46:30
Message-ID: ZwNnpsLaXRm1-LZK@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2024-10-07 05:35:11 Make default subscription streaming option as Parallel
Previous Message Michael Paquier 2024-10-07 04:21:54 Re: GUC names in messages