aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/database.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-08-24 01:14:24 +0000
committerBruce Momjian <bruce@momjian.us>1998-08-24 01:14:24 +0000
commitc0b01461db59a472f5817a8c6e99091b8a48ffc5 (patch)
tree8ea77fde00c4a8da22920d9d0aa7f8b8a77e67e0 /src/backend/utils/misc/database.c
parent9438fe5d091162136e96991da391a559e078aa23 (diff)
downloadpostgresql-c0b01461db59a472f5817a8c6e99091b8a48ffc5.tar.gz
postgresql-c0b01461db59a472f5817a8c6e99091b8a48ffc5.zip
o note that now pg_database has a new attribuite "encoding" even
if MULTIBYTE is not enabled. So be sure to run initdb. o these patches are made against the latest source tree (after Bruce's massive patch, I think) BTW, I noticed that after running regression, the oid field of pg_type seems disappeared. regression=> select oid from pg_type; ERROR: attribute 'oid' not found this happens after the constraints test. This occures with/without my patches. strange... o pg_database_mb.h, pg_class_mb.h, pg_attribute_mb.h are no longer used, and shoud be removed. o GetDatabaseInfo() in utils/misc/database.c removed (actually in #ifdef 0). seems nobody uses. t-ishii@sra.co.jp
Diffstat (limited to 'src/backend/utils/misc/database.c')
-rw-r--r--src/backend/utils/misc/database.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/backend/utils/misc/database.c b/src/backend/utils/misc/database.c
index fa2bb2f1d8b..192737c2019 100644
--- a/src/backend/utils/misc/database.c
+++ b/src/backend/utils/misc/database.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.16 1998/08/19 02:03:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.17 1998/08/24 01:14:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,7 +30,11 @@
#include "utils/builtins.h"
#include "utils/syscache.h"
+#ifdef MULTIBYTE
+#include "mb/pg_wchar.h"
+#endif
+#ifdef 0
/* GetDatabaseInfo()
* Pull database information from pg_database.
*/
@@ -102,6 +106,7 @@ GetDatabaseInfo(char *name, int4 *owner, char *path)
return FALSE;
} /* GetDatabaseInfo() */
+#endif
char *
ExpandDatabasePath(char *dbpath)
@@ -175,7 +180,7 @@ ExpandDatabasePath(char *dbpath)
* --------------------------------
*/
void
-GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path)
+GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encoding)
{
int dbfd;
int fileflags;
@@ -262,13 +267,25 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path)
* means of getting at sys cat attrs.
*/
tup_db = (Form_pg_database) GETSTRUCT(tup);
-
+#ifdef MULTIBYTE
+ /* get encoding from template database.
+ This is the "default for default" for
+ create database command.
+ */
+ if (strcmp("template1",tup_db->datname.data) == 0)
+ {
+ SetTemplateEncoding(tup_db->encoding);
+ }
+#endif
if (strcmp(name, tup_db->datname.data) == 0)
{
*db_id = tup->t_oid;
strncpy(path, VARDATA(&(tup_db->datpath)),
(VARSIZE(&(tup_db->datpath)) - VARHDRSZ));
*(path + VARSIZE(&(tup_db->datpath)) - VARHDRSZ) = '\0';
+#ifdef MULTIBYTE
+ *encoding = tup_db->encoding;
+#endif
goto done;
}