set client_encoding to <nothing> crashes backend.
This commit is contained in:
parent
507a0a2ab0
commit
0c1e2e493d
src/backend/utils/mb
@ -2,7 +2,7 @@
|
|||||||
* This file contains some public functions
|
* This file contains some public functions
|
||||||
* usable for both the backend and the frontend.
|
* usable for both the backend and the frontend.
|
||||||
* Tatsuo Ishii
|
* Tatsuo Ishii
|
||||||
* $Id: common.c,v 1.3 1998/10/06 03:02:21 momjian Exp $ */
|
* $Id: common.c,v 1.4 1999/05/13 10:28:25 ishii Exp $ */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@ -28,6 +28,10 @@ pg_char_to_encoding(const char *s)
|
|||||||
{
|
{
|
||||||
pg_encoding_conv_tbl *p = pg_conv_tbl;
|
pg_encoding_conv_tbl *p = pg_conv_tbl;
|
||||||
|
|
||||||
|
if (!s) {
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
for (; p->encoding >= 0; p++)
|
for (; p->encoding >= 0; p++)
|
||||||
{
|
{
|
||||||
if (!strcasecmp(s, p->name))
|
if (!strcasecmp(s, p->name))
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* This file contains some public functions
|
* This file contains some public functions
|
||||||
* related to show/set/reset variable commands.
|
* related to show/set/reset variable commands.
|
||||||
* Tatsuo Ishii
|
* Tatsuo Ishii
|
||||||
* $Id: variable.c,v 1.2 1998/09/01 04:33:24 momjian Exp $
|
* $Id: variable.c,v 1.3 1999/05/13 10:28:26 ishii Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mb/pg_wchar.h"
|
#include "mb/pg_wchar.h"
|
||||||
@ -13,8 +13,13 @@ parse_client_encoding(const char *value)
|
|||||||
int encoding;
|
int encoding;
|
||||||
|
|
||||||
encoding = pg_valid_client_encoding(value);
|
encoding = pg_valid_client_encoding(value);
|
||||||
if (encoding < 0)
|
if (encoding < 0) {
|
||||||
elog(ERROR, "Client encoding %s is not supported", value);
|
if (value) {
|
||||||
|
elog(ERROR, "Client encoding %s is not supported", value);
|
||||||
|
} else {
|
||||||
|
elog(ERROR, "No client encoding is specified");
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pg_set_client_encoding(encoding))
|
if (pg_set_client_encoding(encoding))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user