v3-0001-Disallow-empty-Foreign-Table-column-option-name-i.patch
application/octet-stream
Filename: v3-0001-Disallow-empty-Foreign-Table-column-option-name-i.patch
Type: application/octet-stream
Part: 1
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v3-0001
Subject: Disallow empty Foreign Table column option name i.e (column_name '') for postgres_fdw.
| File | + | − |
|---|---|---|
| contrib/postgres_fdw/option.c | 16 | 0 |
From 3693492f38743b1431484e6845fd5b668299b501 Mon Sep 17 00:00:00 2001
From: Nishant Sharma <nishant.sharma@enterprisedb.com>
Date: Wed, 9 Oct 2024 14:55:59 +0530
Subject: [PATCH v3 1/2] Disallow empty Foreign Table column option name i.e
(column_name '') for postgres_fdw.
---
contrib/postgres_fdw/option.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/contrib/postgres_fdw/option.c b/contrib/postgres_fdw/option.c
index d740893..dfc95ea 100644
--- a/contrib/postgres_fdw/option.c
+++ b/contrib/postgres_fdw/option.c
@@ -228,6 +228,22 @@ postgres_fdw_validator(PG_FUNCTION_ARGS)
errmsg("invalid value for string option \"%s\": %s",
def->defname, value)));
}
+ else if (strcmp(def->defname, "column_name") == 0 ||
+ strcmp(def->defname, "schema_name") == 0 ||
+ strcmp(def->defname, "table_name") == 0)
+ {
+ char *obj_name_opt = defGetString(def);
+
+ /*
+ * PostgreSQL follows SQL syntax, so we do not allow empty
+ * column_name, schema_name & table_name options.
+ */
+ if (obj_name_opt && obj_name_opt[0] == '\0')
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("cannot use empty value for option \"%s\"",
+ def->defname)));
+ }
}
PG_RETURN_VOID();
--
1.8.3.1