aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/stringutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/stringutils.c')
-rw-r--r--src/bin/psql/stringutils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bin/psql/stringutils.c b/src/bin/psql/stringutils.c
index c74e58d9125..c521749661c 100644
--- a/src/bin/psql/stringutils.c
+++ b/src/bin/psql/stringutils.c
@@ -282,6 +282,7 @@ strip_quotes(char *source, char quote, char escape, int encoding)
* entails_quote - any of these present? need outer quotes
* quote - doubled within string, affixed to both ends
* escape - doubled within string
+ * force_quote - if true, quote the output even if it doesn't "need" it
* encoding - the active character-set encoding
*
* Do not use this as a substitute for PQescapeStringConn(). Use it for
@@ -289,12 +290,13 @@ strip_quotes(char *source, char quote, char escape, int encoding)
*/
char *
quote_if_needed(const char *source, const char *entails_quote,
- char quote, char escape, int encoding)
+ char quote, char escape, bool force_quote,
+ int encoding)
{
const char *src;
char *ret;
char *dst;
- bool need_quotes = false;
+ bool need_quotes = force_quote;
Assert(source != NULL);
Assert(quote != '\0');