Skip to content

Commit fbee976

Browse files
committed
getdatabaseencoding() and PG_encoding_to_char() were being sloppy about
converting char* strings to type 'name'. Imagine my surprise when 7.1 release coredumped upon start when compiled --enable-multibyte ...
1 parent 6ccb2af commit fbee976

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/backend/utils/init/miscinit.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.64 2001/03/22 04:00:00 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.65 2001/04/16 02:42:01 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -168,13 +168,13 @@ SetDataDir(const char *dir)
168168
Datum
169169
getdatabaseencoding(PG_FUNCTION_ARGS)
170170
{
171-
PG_RETURN_NAME("SQL_ASCII");
171+
return DirectFunctionCall1(namein, CStringGetDatum("SQL_ASCII"));
172172
}
173173

174174
Datum
175175
PG_encoding_to_char(PG_FUNCTION_ARGS)
176176
{
177-
PG_RETURN_NAME("SQL_ASCII");
177+
return DirectFunctionCall1(namein, CStringGetDatum("SQL_ASCII"));
178178
}
179179

180180
Datum

src/backend/utils/mb/common.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* This file contains some public functions
33
* usable for both the backend and the frontend.
44
* Tatsuo Ishii
5-
* $Id: common.c,v 1.12 2001/02/11 01:59:22 ishii Exp $
5+
* $Id: common.c,v 1.13 2001/04/16 02:42:01 tgl Exp $
66
*/
77
#include "postgres.h"
88

@@ -91,8 +91,9 @@ Datum
9191
PG_encoding_to_char(PG_FUNCTION_ARGS)
9292
{
9393
int32 encoding = PG_GETARG_INT32(0);
94+
const char *encoding_name = pg_encoding_to_char(encoding);
9495

95-
PG_RETURN_NAME(pg_encoding_to_char(encoding));
96+
return DirectFunctionCall1(namein, CStringGetDatum(encoding_name));
9697
}
9798

9899
#endif

src/backend/utils/mb/mbutils.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* client encoding and server internal encoding.
44
* (currently mule internal code (mic) is used)
55
* Tatsuo Ishii
6-
* $Id: mbutils.c,v 1.16 2001/03/08 00:24:34 tgl Exp $
6+
* $Id: mbutils.c,v 1.17 2001/04/16 02:42:01 tgl Exp $
77
*/
88
#include "postgres.h"
99

@@ -287,5 +287,7 @@ GetDatabaseEncoding()
287287
Datum
288288
getdatabaseencoding(PG_FUNCTION_ARGS)
289289
{
290-
PG_RETURN_NAME(pg_encoding_to_char(DatabaseEncoding));
290+
const char *encoding_name = pg_encoding_to_char(DatabaseEncoding);
291+
292+
return DirectFunctionCall1(namein, CStringGetDatum(encoding_name));
291293
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy