set client_encoding to <nothing> crashes backend.
authorTatsuo Ishii <[email protected]>
Thu, 13 May 1999 10:28:26 +0000 (10:28 +0000)
committerTatsuo Ishii <[email protected]>
Thu, 13 May 1999 10:28:26 +0000 (10:28 +0000)
src/backend/utils/mb/common.c
src/backend/utils/mb/variable.c

index d83abcafba91ec137fbd27794dcc2c850f721746..65f796a70e19449b1861900e0e7d7ad9f9f0e0d3 100644 (file)
@@ -28,6 +28,10 @@ pg_char_to_encoding(const char *s)
 {
        pg_encoding_conv_tbl *p = pg_conv_tbl;
 
+        if (!s) {
+               return (-1);
+       }
+
        for (; p->encoding >= 0; p++)
        {
                if (!strcasecmp(s, p->name))
index 1a74702032050a8b58baf2dd6aedb4ae5cc91481..ecda8b32144d7c63704d8c3d159ee86568d43119 100644 (file)
@@ -13,8 +13,13 @@ parse_client_encoding(const char *value)
        int                     encoding;
 
        encoding = pg_valid_client_encoding(value);
-       if (encoding < 0)
-               elog(ERROR, "Client encoding %s is not supported", value);
+       if (encoding < 0) {
+               if (value) {
+                       elog(ERROR, "Client encoding %s is not supported", value);
+               } else {
+                       elog(ERROR, "No client encoding is specified");
+               }
+       }
        else
        {
                if (pg_set_client_encoding(encoding))