v2-0001-Disallow-empty-Foreign-Table-column-option-name-i.patch
application/octet-stream
Filename: v2-0001-Disallow-empty-Foreign-Table-column-option-name-i.patch
Type: application/octet-stream
Part: 0
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 v2-0001
Subject: Disallow empty Foreign Table column option name i.e (column_name '') for postgres_fdw.
| File | + | − |
|---|---|---|
| contrib/postgres_fdw/option.c | 13 | 0 |
From 16d2cb15ae67beb646ba931993bff15dab356f00 Mon Sep 17 00:00:00 2001
From: Nishant Sharma <nishant.sharma@enterprisedb.com>
Date: Thu, 22 Aug 2024 12:53:43 +0530
Subject: [PATCH v2 1/2] Disallow empty Foreign Table column option name i.e
(column_name '') for postgres_fdw.
---
contrib/postgres_fdw/option.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/contrib/postgres_fdw/option.c b/contrib/postgres_fdw/option.c
index 630b304..2f76610 100644
--- a/contrib/postgres_fdw/option.c
+++ b/contrib/postgres_fdw/option.c
@@ -228,6 +228,19 @@ 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)
+ {
+ 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")));
+ }
}
PG_RETURN_VOID();
--
1.8.3.1