aboutsummaryrefslogtreecommitdiff
path: root/src/include/fe_utils/string_utils.h
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2025-02-10 10:03:38 -0500
committerAndres Freund <andres@anarazel.de>2025-02-10 10:03:38 -0500
commit61ad93cdd48ecc8c6edf943f4d888a9325b66882 (patch)
tree6d8a4f72c63a8173f4baa9388bc8f7a1621a5214 /src/include/fe_utils/string_utils.h
parent7d43ca6fe068015b403ffa1762f4df4efdf68b69 (diff)
downloadpostgresql-61ad93cdd48ecc8c6edf943f4d888a9325b66882.tar.gz
postgresql-61ad93cdd48ecc8c6edf943f4d888a9325b66882.zip
Specify the encoding of input to fmtId()
This commit adds fmtIdEnc() and fmtQualifiedIdEnc(), which allow to specify the encoding as an explicit argument. Additionally setFmtEncoding() is provided, which defines the encoding when no explicit encoding is provided, to avoid breaking all code using fmtId(). All users of fmtId()/fmtQualifiedId() are either converted to the explicit version or a call to setFmtEncoding() has been added. This commit does not yet utilize the now well-defined encoding, that will happen in a subsequent commit. Reviewed-by: Noah Misch <noah@leadboat.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Backpatch-through: 13 Security: CVE-2025-1094
Diffstat (limited to 'src/include/fe_utils/string_utils.h')
-rw-r--r--src/include/fe_utils/string_utils.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/include/fe_utils/string_utils.h b/src/include/fe_utils/string_utils.h
index f150a7f7ef7..500f585a4a5 100644
--- a/src/include/fe_utils/string_utils.h
+++ b/src/include/fe_utils/string_utils.h
@@ -25,7 +25,10 @@ extern PQExpBuffer (*getLocalPQExpBuffer) (void);
/* Functions */
extern const char *fmtId(const char *rawid);
+extern const char *fmtIdEnc(const char *rawid, int encoding);
extern const char *fmtQualifiedId(const char *schema, const char *id);
+extern const char *fmtQualifiedIdEnc(const char *schema, const char *id, int encoding);
+extern void setFmtEncoding(int encoding);
extern char *formatPGVersionNumber(int version_number, bool include_minor,
char *buf, size_t buflen);