From c0b01461db59a472f5817a8c6e99091b8a48ffc5 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Mon, 24 Aug 1998 01:14:24 +0000
Subject: [PATCH] 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
---
 src/backend/bootstrap/bootparse.y     |   7 +-
 src/backend/bootstrap/bootscanner.l   |  10 +-
 src/backend/commands/copy.c           |  61 +++-
 src/backend/commands/dbcommands.c     |   9 +-
 src/backend/commands/rename.c         |   6 +-
 src/backend/parser/gram.y             |   5 +-
 src/backend/storage/lmgr/lmgr.c       |   6 +-
 src/backend/storage/smgr/md.c         |  15 +-
 src/backend/tcop/utility.c            |   6 +-
 src/backend/utils/cache/Makefile      |   5 +-
 src/backend/utils/cache/fcache.c      |   6 +-
 src/backend/utils/init/postinit.c     |  15 +-
 src/backend/utils/mb/conv.c           |  33 +-
 src/backend/utils/mb/wchar.c          |   4 +-
 src/backend/utils/misc/database.c     |  23 +-
 src/bin/initdb/initdb.sh              |   9 +-
 src/bin/pg_dump/pg_dumpall            |  11 +-
 src/include/catalog/pg_attribute.h    |   5 +-
 src/include/catalog/pg_attribute_mb.h | 466 --------------------------
 src/include/catalog/pg_class.h        |   4 +-
 src/include/catalog/pg_class_mb.h     | 166 ---------
 src/include/catalog/pg_database.h     |  11 +-
 src/include/catalog/pg_database_mb.h  |  56 ----
 src/include/commands/dbcommands.h     |   6 +-
 src/include/mb/pg_wchar.h             |  31 +-
 src/include/miscadmin.h               |   6 +-
 src/include/nodes/parsenodes.h        |   4 +-
 27 files changed, 171 insertions(+), 815 deletions(-)
 delete mode 100644 src/include/catalog/pg_attribute_mb.h
 delete mode 100644 src/include/catalog/pg_class_mb.h
 delete mode 100644 src/include/catalog/pg_database_mb.h

diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y
index 393434ebc4d..162ca00e78d 100644
--- a/src/backend/bootstrap/bootparse.y
+++ b/src/backend/bootstrap/bootparse.y
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.20 1998/08/19 02:01:23 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.21 1998/08/24 01:13:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,13 +31,8 @@
 #include "bootstrap/bootstrap.h"
 #include "catalog/heap.h"
 #include "catalog/pg_am.h"
-#ifdef MULTIBYTE
-#include "catalog/pg_attribute_mb.h"
-#include "catalog/pg_class_mb.h"
-#else
 #include "catalog/pg_attribute.h"
 #include "catalog/pg_class.h"
-#endif
 #include "commands/defrem.h"
 #include "nodes/nodes.h"
 #include "nodes/parsenodes.h"
diff --git a/src/backend/bootstrap/bootscanner.l b/src/backend/bootstrap/bootscanner.l
index a97fb7fc571..189b717bb6b 100644
--- a/src/backend/bootstrap/bootscanner.l
+++ b/src/backend/bootstrap/bootscanner.l
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.10 1998/07/26 04:30:19 scrappy Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.11 1998/08/24 01:13:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -20,11 +20,7 @@
 #include "storage/block.h"
 #include "storage/off.h"
 #include "storage/itemptr.h"
-#ifdef MULTIBYTE
-#include "catalog/pg_attribute_mb.h"
-#else
 #include "catalog/pg_attribute.h"
-#endif
 #include "access/attnum.h"
 #include "nodes/pg_list.h"
 #include "access/tupdesc.h"
@@ -32,11 +28,7 @@
 #include "access/funcindex.h"
 #include "storage/fd.h"
 #include "catalog/pg_am.h"
-#ifdef MULTIBYTE
-#include "catalog/pg_class_mb.h"
-#else
 #include "catalog/pg_class.h"
-#endif
 #include "nodes/nodes.h"
 #include "rewrite/prs2lock.h"
 #include "access/skey.h"
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 34372db2a7d..5f974322a13 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.53 1998/08/19 02:01:44 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.54 1998/08/24 01:13:39 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,6 +37,10 @@
 #include "commands/trigger.h"
 #include <storage/fd.h>
 
+#ifdef MULTIBYTE
+#include "mb/pg_wchar.h"
+#endif
+
 #define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
 #define VALUE(c) ((c) - '0')
 
@@ -61,7 +65,7 @@ static char *CopyReadAttribute(FILE *fp, bool *isnull, char *delim, int *newline
 static char *CopyReadAttribute(FILE *fp, bool *isnull, char *delim);
 
 #endif
-static void CopyAttributeOut(FILE *fp, char *string, char *delim, int is_array);
+static void CopyAttributeOut(FILE *fp, unsigned char *string, char *delim, int is_array);
 static int	CountTuples(Relation relation);
 
 extern FILE *Pfout,
@@ -1006,6 +1010,17 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
 	char		c;
 	int			done = 0;
 	int			i = 0;
+#ifdef MULTIBYTE
+	int	mblen;
+	int	encoding;
+	unsigned char	s[2];
+	int	j;
+#endif
+
+#ifdef MULTIBYTE
+	encoding = pg_get_client_encoding();
+	s[1] = 0;
+#endif
 
 #ifdef COPY_PATCH
 	/* if last delimiter was a newline return a NULL attribute */
@@ -1108,19 +1123,53 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
 		}
 		if (!done)
 			attribute[i++] = c;
+#ifdef MULTIBYTE
+			s[0] = c;
+			mblen = pg_encoding_mblen(encoding, s);
+			mblen--;
+			for(j=0;j<mblen;j++) {
+			  c = getc(fp);
+			  if (feof(fp))
+			    return (NULL);
+			  attribute[i++] = c;
+			}
+#endif
 		if (i == EXT_ATTLEN - 1)
 			elog(ERROR, "CopyReadAttribute - attribute length too long. line: %d", lineno);
 	}
 	attribute[i] = '\0';
+#ifdef MULTIBYTE
+	return(pg_client_to_server((unsigned char*)attribute, strlen(attribute)));
+#else
 	return (&attribute[0]);
+#endif
 }
 
 static void
-CopyAttributeOut(FILE *fp, char *string, char *delim, int is_array)
+CopyAttributeOut(FILE *fp, unsigned char *server_string, char *delim, int is_array)
 {
+        unsigned char           *string;
 	char		c;
 
+#ifdef MULTIBYTE
+	int	mblen;
+	int	encoding;
+	int	i;
+#endif
+
+#ifdef MULTIBYTE
+	string = pg_server_to_client(server_string, strlen(server_string));
+	encoding = pg_get_client_encoding();
+#else
+	string = server_string;
+#endif
+
+#ifdef MULTIBYTE
+	for (; (mblen = pg_encoding_mblen(encoding, string)) &&
+	       ((c = *string) != '\0'); string += mblen)
+#else
 	for (; (c = *string) != '\0'; string++)
+#endif
 	{
 		if (c == delim[0] || c == '\n' ||
 			(c == '\\' && !is_array))
@@ -1142,7 +1191,13 @@ CopyAttributeOut(FILE *fp, char *string, char *delim, int is_array)
 				fputc('\\', fp);
 			}
 		}
+#ifdef MULTIBYTE
+		for (i=0;i<mblen;i++) {
+			fputc(*(string+i), fp);
+		}
+#else
 		fputc(*string, fp);
+#endif
 	}
 }
 
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index a0438129dff..80cb60f203a 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.20 1998/08/19 02:01:46 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.21 1998/08/24 01:13:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -43,7 +43,7 @@ static HeapTuple get_pg_dbtup(char *command, char *dbname, Relation dbrel);
 static void stop_vacuum(char *dbpath, char *dbname);
 
 void
-createdb(char *dbname, char *dbpath)
+createdb(char *dbname, char *dbpath, int encoding)
 {
 	Oid			db_id,
 				user_id;
@@ -90,8 +90,9 @@ createdb(char *dbname, char *dbpath)
 			dbname, user_id, dbname);
 #endif
 
-	sprintf(buf, "insert into pg_database (datname, datdba, datpath)"
-			" values (\'%s\', \'%d\', \'%s\');", dbname, user_id, loc);
+	sprintf(buf, "insert into pg_database (datname, datdba, encoding, datpath)"
+			" values (\'%s\', \'%d\', \'%d\', \'%s\');", dbname, user_id, encoding, loc);
+
 
 	pg_exec_query(buf);
 }
diff --git a/src/backend/commands/rename.c b/src/backend/commands/rename.c
index fdc7b43fdcc..8ac94ae22d8 100644
--- a/src/backend/commands/rename.c
+++ b/src/backend/commands/rename.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.14 1998/08/19 02:01:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.15 1998/08/24 01:13:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,11 +31,7 @@
 #include <utils/excid.h>
 #include <utils/mcxt.h>
 #include <catalog/pg_proc.h>
-#ifdef MULTIBYTE
-#include <catalog/pg_class_mb.h>
-#else
 #include <catalog/pg_class.h>
-#endif
 #include <optimizer/internal.h>
 #include <optimizer/prep.h>		/* for find_all_inheritors */
 #ifndef NO_SECURITY
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 23db7a10731..a81f0f6a35a 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.23 1998/08/18 00:48:55 scrappy Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.24 1998/08/24 01:13:44 momjian Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -2142,6 +2142,7 @@ CreatedbStmt:  CREATE DATABASE database_name WITH opt_database1 opt_database2
 #else
 					if ($6 != NULL)
 						elog(ERROR, "WITH ENCODING is not supported");
+					n->encoding = 0;
 #endif
 					$$ = (Node *)n;
 				}
@@ -2152,6 +2153,8 @@ CreatedbStmt:  CREATE DATABASE database_name WITH opt_database1 opt_database2
 					n->dbpath = NULL;
 #ifdef MULTIBYTE
 					n->encoding = GetTemplateEncoding();
+#else
+					n->encoding = 0;
 #endif
 					$$ = (Node *)n;
 				}
diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c
index bcdc57d54fc..a24d7298087 100644
--- a/src/backend/storage/lmgr/lmgr.c
+++ b/src/backend/storage/lmgr/lmgr.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.17 1998/08/19 02:02:40 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.18 1998/08/24 01:13:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -41,11 +41,7 @@
 
 #include "catalog/catname.h"
 #include "catalog/catalog.h"
-#ifdef MULTIBYTE
-#include "catalog/pg_class_mb.h"
-#else
 #include "catalog/pg_class.h"
-#endif
 
 #include "nodes/memnodes.h"
 #include "storage/bufmgr.h"
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index 74df4039063..c753b583d85 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.36 1998/08/11 18:28:15 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.37 1998/08/24 01:13:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -568,15 +568,9 @@ mdblindwrt(char *dbstr,
 		int4		owner;
 		Oid			id;
 		char	   *tmpPath;
-#ifdef MULTIBYTE
 		int	   tmpEncoding;
-#endif
 
-#ifdef MULTIBYTE
 		GetRawDatabaseInfo(dbstr, &owner, &id, dbpath, &tmpEncoding);
-#else
-		GetRawDatabaseInfo(dbstr, &owner, &id, dbpath);
-#endif
 
 		if (id != dbid)
 			elog(FATAL, "mdblindwrt: oid of db %s is not %u", dbstr, dbid);
@@ -613,16 +607,9 @@ mdblindwrt(char *dbstr,
 		int4		owner;
 		Oid			id;
 		char	   *tmpPath;
-
-#ifdef MULTIBYTE
 		int	   tmpEncoding;
-#endif
 
-#ifdef MULTIBYTE
 		GetRawDatabaseInfo(dbstr, &owner, &id, dbpath, &tmpEncoding);
-#else
-		GetRawDatabaseInfo(dbstr, &owner, &id, dbpath);
-#endif
 
 		if (id != dbid)
 			elog(FATAL, "mdblindwrt: oid of db %s is not %u", dbstr, dbid);
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 75d51086d31..4fb548b34b9 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.45 1998/08/06 05:12:48 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.46 1998/08/24 01:13:50 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -558,11 +558,7 @@ ProcessUtility(Node *parsetree,
 
 				*ps_status = commandTag = "CREATEDB";
 				CHECK_IF_ABORTED();
-#ifdef MULTIBYTE
 				createdb(stmt->dbname, stmt->dbpath, stmt->encoding);
-#else
-				createdb(stmt->dbname, stmt->dbpath);
-#endif
 			}
 			break;
 
diff --git a/src/backend/utils/cache/Makefile b/src/backend/utils/cache/Makefile
index ada76622cd9..5df81fca134 100644
--- a/src/backend/utils/cache/Makefile
+++ b/src/backend/utils/cache/Makefile
@@ -4,7 +4,7 @@
 #    Makefile for utils/cache
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/backend/utils/cache/Makefile,v 1.8 1998/07/26 04:30:54 scrappy Exp $
+#    $Header: /cvsroot/pgsql/src/backend/utils/cache/Makefile,v 1.9 1998/08/24 01:13:52 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -12,9 +12,6 @@ SRCDIR = ../../..
 include ../../../Makefile.global
 
 CFLAGS += -I../..
-ifdef MULTIBYTE
-CFLAGS+= $(MBFLAGS)
-endif
 
 OBJS = catcache.o inval.o rel.o relcache.o syscache.o lsyscache.o fcache.o
 
diff --git a/src/backend/utils/cache/fcache.c b/src/backend/utils/cache/fcache.c
index 13d42341239..89351db8c82 100644
--- a/src/backend/utils/cache/fcache.c
+++ b/src/backend/utils/cache/fcache.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.15 1998/08/19 02:03:09 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.16 1998/08/24 01:13:54 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -22,11 +22,7 @@
 #include "catalog/pg_type.h"
 #include "catalog/pg_proc.h"
 #include "catalog/pg_language.h"
-#ifdef MULTIBYTE
-#include "catalog/pg_class_mb.h"
-#else
 #include "catalog/pg_class.h"
-#endif
 #include "parser/parsetree.h"	/* for getrelname() */
 #include "utils/builtins.h"
 #include "utils/fcache.h"
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 12d1255b9ba..790684cda13 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.33 1998/08/11 18:28:28 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.34 1998/08/24 01:13:56 momjian Exp $
  *
  * NOTES
  *		InitPostgres() is the function called from PostgresMain
@@ -67,10 +67,7 @@
 
 #include "catalog/catname.h"
 #ifdef MULTIBYTE
-#include "catalog/pg_database_mb.h"
 #include "mb/pg_wchar.h"
-#else
-#include "catalog/pg_database.h"
 #endif
 
 #include "libpq/libpq.h"
@@ -83,11 +80,7 @@ static void InitStdio(void);
 static void InitUserid(void);
 
 extern char *ExpandDatabasePath(char *name);
-#ifdef MULTIBYTE
 extern void GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encoding);
-#else
-extern void GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path);
-#endif
 
 static IPCKey PostgresIpcKey;
 
@@ -128,16 +121,10 @@ InitMyDatabaseInfo(char *name)
 	int4		owner;
 	char	   *path,
 				myPath[MAXPGPATH + 1];
-#ifdef MULTIBYTE
 	int encoding;
-#endif
 
 	SetDatabaseName(name);
-#ifdef MULTIBYTE
 	GetRawDatabaseInfo(name, &owner, &MyDatabaseId, myPath, &encoding);
-#else
-	GetRawDatabaseInfo(name, &owner, &MyDatabaseId, myPath);
-#endif
 
 	if (!OidIsValid(MyDatabaseId))
 		elog(FATAL,
diff --git a/src/backend/utils/mb/conv.c b/src/backend/utils/mb/conv.c
index bca95c5f6b6..01c92e3b9af 100644
--- a/src/backend/utils/mb/conv.c
+++ b/src/backend/utils/mb/conv.c
@@ -2,7 +2,7 @@
  * conversion between client encoding and server internal encoding
  * (currently mule internal code (mic) is used)
  * Tatsuo Ishii
- * $Id: conv.c,v 1.1 1998/07/24 03:31:56 scrappy Exp $
+ * $Id: conv.c,v 1.2 1998/08/24 01:13:59 momjian Exp $
  */
 #include <stdio.h>
 #include <string.h>
@@ -369,7 +369,38 @@ static void mic2latin5(unsigned char *mic, unsigned char *p, int len)
   mic2latin(mic, p, len, LC_ISO8859_5);
 }
 
+/*
+ * ASCII ---> MIC
+ */
+static void ascii2mic(unsigned char *l, unsigned char *p, int len)
+{
+  int c1;
+
+  while (len-- > 0 && (c1 = *l++)) {
+    *p++ = (c1 & 0x7f);
+  }
+  *p = '\0';
+}
+
+/*
+ * MIC ---> ASCII
+ */
+static void mic2ascii(unsigned char *mic, unsigned char *p, int len)
+{
+  int c1;
+
+  while (len > 0 && (c1 = *mic)) {
+    if (c1 > 0x7f) {
+      printBogusChar(&mic, &p);
+    } else {      /* should be ASCII */
+      *p++ = c1;
+    }
+  }
+  *p = '\0';
+}
+
 pg_encoding_conv_tbl pg_conv_tbl[] = {
+  {SQL_ASCII, "SQL_ASCII", 0, ascii2mic, mic2ascii},	/* SQL/ACII */
   {EUC_JP, "EUC_JP", 0, euc_jp2mic, mic2euc_jp},	/* EUC_JP */
   {EUC_CN, "EUC_CN", 0, euc_cn2mic, mic2euc_cn},	/* EUC_CN */
   {EUC_KR, "EUC_KR", 0, euc_kr2mic, mic2euc_kr},	/* EUC_KR */
diff --git a/src/backend/utils/mb/wchar.c b/src/backend/utils/mb/wchar.c
index ecb7b543594..f83c4628672 100644
--- a/src/backend/utils/mb/wchar.c
+++ b/src/backend/utils/mb/wchar.c
@@ -1,7 +1,7 @@
 /*
  * conversion functions between pg_wchar and multi-byte streams.
  * Tatsuo Ishii
- * $Id: wchar.c,v 1.1 1998/07/24 03:31:57 scrappy Exp $
+ * $Id: wchar.c,v 1.2 1998/08/24 01:14:01 momjian Exp $
  */
 
 #include "mb/pg_wchar.h"
@@ -316,6 +316,7 @@ static int pg_sjis_mblen(const unsigned char *s)
 }
 
 pg_wchar_tbl pg_wchar_table[] = {
+  {0, 0},
   {pg_eucjp2wchar_with_len, pg_eucjp_mblen},
   {pg_euccn2wchar_with_len, pg_euccn_mblen},
   {pg_euckr2wchar_with_len, pg_euckr_mblen},
@@ -347,7 +348,6 @@ pg_wchar_tbl pg_wchar_table[] = {
   {0, 0},
   {0, 0},
   {0, 0},
-  {0, 0},
   {0, pg_sjis_mblen}
 };
 
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;
 			}
diff --git a/src/bin/initdb/initdb.sh b/src/bin/initdb/initdb.sh
index 96b83a713de..df645dcf172 100644
--- a/src/bin/initdb/initdb.sh
+++ b/src/bin/initdb/initdb.sh
@@ -26,7 +26,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.52 1998/08/22 05:19:23 momjian Exp $
+#    $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.53 1998/08/24 01:14:04 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -37,6 +37,7 @@
 # ----------------
 
 CMDNAME=`basename $0`
+MULTIBYTEID=0
 
 MULTIBYTE=__MULTIBYTE__
 if [  -n "$MULTIBYTE" ];then
@@ -374,11 +375,7 @@ if [ $template_only -eq 0 ]; then
     echo "Adding template1 database to pg_database..."
 
     echo "open pg_database" > /tmp/create.$$
-    if [ -z "$MULTIBYTE" ];then
-	echo "insert (template1 $POSTGRES_SUPERUID template1)" >> /tmp/create.$$
-    else
-	echo "insert (template1 $POSTGRES_SUPERUID $MULTIBYTEID template1)" >> /tmp/create.$$
-    fi
+    echo "insert (template1 $POSTGRES_SUPERUID $MULTIBYTEID template1)" >> /tmp/create.$$
     #echo "show" >> /tmp/create.$$
     echo "close pg_database" >> /tmp/create.$$
 
diff --git a/src/bin/pg_dump/pg_dumpall b/src/bin/pg_dump/pg_dumpall
index 48e313afec8..78344324cf7 100644
--- a/src/bin/pg_dump/pg_dumpall
+++ b/src/bin/pg_dump/pg_dumpall
@@ -48,7 +48,7 @@ drop table tmp_pg_shadow;
 END
 echo "${BS}."
 psql -l -A -q -t| tr '|' ' ' | grep -v '^template1 ' | \
-while read DATABASE DBUSERID DATAPATH
+while read DATABASE DBUSERID ENCODING DATAPATH
 do
 	POSTGRES_USER="`echo \" \
 		select usename \
@@ -56,7 +56,14 @@ do
 		where usesysid = $DBUSERID; \" | \
 		psql -A -q -t template1`"
 	echo "${BS}connect template1 $POSTGRES_USER"
-	echo "create database $DATABASE;"
+
+	if createdb -help|grep encoding >/dev/null
+	then
+		echo "create database with encoding='`pg_encoding $ENCODING`' $DATABASE;"
+	else
+		echo "create database $DATABASE;"
+	fi
+
 	echo "${BS}connect $DATABASE $POSTGRES_USER"
 	pg_dump ${1+"$@"} $DATABASE
 	if [ "$?" -ne 0 ]
diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h
index 9a20dd825e9..8d275f9778c 100644
--- a/src/include/catalog/pg_attribute.h
+++ b/src/include/catalog/pg_attribute.h
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_attribute.h,v 1.34 1998/08/11 18:28:39 momjian Exp $
+ * $Id: pg_attribute.h,v 1.35 1998/08/24 01:14:09 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -224,7 +224,8 @@ DATA(insert OID = 0 ( 1247 cmax				29 0  4  -6 0 -1 -1 t f i f f));
  */
 DATA(insert OID = 0 ( 1262 datname			19 0 NAMEDATALEN   1 0 -1 -1 f f i f f));
 DATA(insert OID = 0 ( 1262 datdba			23 0  4   2 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1262 datpath			25 0 -1   3 0 -1 -1 f f i f f));
+DATA(insert OID = 0 ( 1262 encoding			23 0  4   3 0 -1 -1 t f s f f));
+DATA(insert OID = 0 ( 1262 datpath			25 0 -1   4 0 -1 -1 f f i f f));
 DATA(insert OID = 0 ( 1262 ctid				27 0  6  -1 0 -1 -1 f f i f f));
 DATA(insert OID = 0 ( 1262 oid				26 0  4  -2 0 -1 -1 t f i f f));
 DATA(insert OID = 0 ( 1262 xmin				28 0  4  -3 0 -1 -1 f f i f f));
diff --git a/src/include/catalog/pg_attribute_mb.h b/src/include/catalog/pg_attribute_mb.h
deleted file mode 100644
index 732c604468f..00000000000
--- a/src/include/catalog/pg_attribute_mb.h
+++ /dev/null
@@ -1,466 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * pg_attribute.h--
- *	  definition of the system "attribute" relation (pg_attribute)
- *	  along with the relation's initial contents.
- *
- *
- * Copyright (c) 1994, Regents of the University of California
- *
- * $Id: pg_attribute_mb.h,v 1.3 1998/08/11 18:28:41 momjian Exp $
- *
- * NOTES
- *	  the genbki.sh script reads this file and generates .bki
- *	  information from the DATA() statements.
- *
- *	  utils/cache/relcache.c requires some hard-coded tuple descriptors
- *	  for some of the system catalogs so if the schema for any of
- *	  these changes, be sure and change the appropriate Schema_xxx
- *	  macros!  -cim 2/5/91
- *
- *-------------------------------------------------------------------------
- */
-#ifndef PG_ATTRIBUTE_H
-#define PG_ATTRIBUTE_H
-
-/* ----------------
- *		postgres.h contains the system type definintions and the
- *		CATALOG(), BOOTSTRAP and DATA() sugar words so this file
- *		can be read by both genbki.sh and the C compiler.
- * ----------------
- */
-
-/* ----------------
- *		pg_attribute definition.  cpp turns this into
- *		typedef struct FormData_pg_attribute
- *
- *		If you change the following, make sure you change the structs for
- *		system attributes in heap.c and index.c also.
- * ----------------
- */
-CATALOG(pg_attribute) BOOTSTRAP
-{
-	Oid			attrelid;
-	NameData	attname;
-	Oid			atttypid;
-
-	/*
-	 * atttypid is the OID of the instance in Catalog Class pg_type that
-	 * defines the data type of this attribute (e.g. int4).  Information
-	 * in that instance is redundant with the attlen, attbyval, and
-	 * attalign attributes of this instance, so they had better match or
-	 * Postgres will fail.
-	 */
-	float4		attdisbursion;
-	int2		attlen;
-
-	/*
-	 * attlen is a copy of the typlen field from pg_type for this
-	 * attribute.  See atttypid above.	See struct TypeTupleFormData for
-	 * definition.
-	 */
-	int2		attnum;
-
-	/*
-	 * attnum is the "attribute number" for the attribute:	A value that
-	 * uniquely identifies this attribute within its class. For user
-	 * attributes, Attribute numbers are greater than 0 and not greater
-	 * than the number of attributes in the class. I.e. if the Class
-	 * pg_class says that Class XYZ has 10 attributes, then the user
-	 * attribute numbers in Class pg_attribute must be 1-10.
-	 *
-	 * System attributes have attribute numbers less than 0 that are unique
-	 * within the class, but not constrained to any particular range.
-	 *
-	 * Note that (attnum - 1) is often used as the index to an array.
-	 */
-	int4		attnelems;
-
-	int4		attcacheoff;
-
-	/*
-	 * fastgetattr() uses attcacheoff to cache byte offsets of attributes
-	 * in heap tuples.	The data actually stored in pg_attribute (-1)
-	 * indicates no cached value.  But when we copy these tuples into a
-	 * tuple descriptor, we may then update attcacheoff in the copies.
-	 * This speeds up the attribute walking process.
-	 */
-
-	int4		atttypmod;
-
-	/*
-	 * atttypmod records type-specific modifications supplied at table
-	 * creation time, and passes it to input and output functions as the
-	 * third argument.
-	 */
-
-	bool		attbyval;
-
-	/*
-	 * attbyval is a copy of the typbyval field from pg_type for this
-	 * attribute.  See atttypid above.	See struct TypeTupleFormData for
-	 * definition.
-	 */
-	bool		attisset;
-	char		attalign;
-
-	/*
-	 * attalign is a copy of the typalign field from pg_type for this
-	 * attribute.  See atttypid above.	See struct TypeTupleFormData for
-	 * definition.
-	 */
-	bool		attnotnull;
-
-	/* This flag represents the "NOT NULL" constraint */
-	bool		atthasdef;
-
-	/* Has DEFAULT value or not */
-} FormData_pg_attribute;
-
-/*
- * someone should figure out how to do this properly. (The problem is
- * the size of the C struct is not the same as the size of the tuple.)
- */
-#define ATTRIBUTE_TUPLE_SIZE \
-	(offsetof(FormData_pg_attribute,atthasdef) + sizeof(char))
-
-/* ----------------
- *		Form_pg_attribute corresponds to a pointer to a tuple with
- *		the format of pg_attribute relation.
- * ----------------
- */
-typedef FormData_pg_attribute *AttributeTupleForm;
-
-/* ----------------
- *		compiler constants for pg_attribute
- * ----------------
- */
-
-#define Natts_pg_attribute				14
-#define Anum_pg_attribute_attrelid		1
-#define Anum_pg_attribute_attname		2
-#define Anum_pg_attribute_atttypid		3
-#define Anum_pg_attribute_attdisbursion 4
-#define Anum_pg_attribute_attlen		5
-#define Anum_pg_attribute_attnum		6
-#define Anum_pg_attribute_attnelems		7
-#define Anum_pg_attribute_attcacheoff	8
-#define Anum_pg_attribute_atttypmod		9
-#define Anum_pg_attribute_attbyval		10
-#define Anum_pg_attribute_attisset		11
-#define Anum_pg_attribute_attalign		12
-#define Anum_pg_attribute_attnotnull	13
-#define Anum_pg_attribute_atthasdef		14
-
-
-/* ----------------
- *		SCHEMA_ macros for declaring hardcoded tuple descriptors.
- *		these are used in utils/cache/relcache.c
- * ----------------
-#define SCHEMA_NAME(x) CppConcat(Name_,x)
-#define SCHEMA_DESC(x) CppConcat(Desc_,x)
-#define SCHEMA_NATTS(x) CppConcat(Natts_,x)
-#define SCHEMA_DEF(x) \
-	FormData_pg_attribute \
-	SCHEMA_DESC(x) [ SCHEMA_NATTS(x) ] = \
-	{ \
-		CppConcat(Schema_,x) \
-	}
- */
-
-/* ----------------
- *		initial contents of pg_attribute
- * ----------------
- */
-
-/* ----------------
- *		pg_type schema
- * ----------------
- */
-#define Schema_pg_type \
-{ 1247, {"typname"},	   19, 0, NAMEDATALEN,  1, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
-{ 1247, {"typowner"},	   23, 0,	4,	2, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247, {"typlen"},		   21, 0,	2,	3, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1247, {"typprtlen"},     21, 0,	2,	4, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1247, {"typbyval"},	   16, 0,	1,	5, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1247, {"typtype"},	   18, 0,	1,	6, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1247, {"typisdefined"},  16, 0,	1,	7, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1247, {"typdelim"},	   18, 0,	1,	8, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1247, {"typrelid"},	   26, 0,	4,	9, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247, {"typelem"},	   26, 0,	4, 10, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247, {"typinput"},	   24, 0,	4, 11, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247, {"typoutput"},     24, 0,	4, 12, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247, {"typreceive"},    24, 0,	4, 13, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247, {"typsend"},	   24, 0,	4, 14, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247, {"typalign"},	   18, 0,	1, 15, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1247, {"typdefault"},    25, 0,  -1, 16, 0, -1, -1, '\0'	, '\0', 'i', '\0', '\0' }
-
-DATA(insert OID = 0 ( 1247 typname			19 0 NAMEDATALEN   1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1247 typowner			23 0  4   2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1247 typlen			21 0  2   3 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1247 typprtlen		21 0  2   4 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1247 typbyval			16 0  1   5 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1247 typtype			18 0  1   6 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1247 typisdefined		16 0  1   7 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1247 typdelim			18 0  1   8 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1247 typrelid			26 0  4   9 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1247 typelem			26 0  4  10 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1247 typinput			24 0  4  11 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1247 typoutput		24 0  4  12 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1247 typreceive		24 0  4  13 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1247 typsend			24 0  4  14 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1247 typalign			18 0  1  15 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1247 typdefault		25 0 -1  16 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1247 ctid				27 0  6  -1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1247 oid				26 0  4  -2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1247 xmin				28 0  4  -3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1247 cmin				29 0  4  -4 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1247 xmax				28 0  4  -5 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1247 cmax				29 0  4  -6 0 -1 -1 t f i f f));
-
-/* ----------------
- *		pg_database
- * ----------------
- */
-DATA(insert OID = 0 ( 1262 datname			19 0 NAMEDATALEN   1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1262 datdba			23 0  4   2 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1262 encoding			23 0  4   3 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1262 datpath			25 0 -1   4 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1262 ctid				27 0  6  -1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1262 oid				26 0  4  -2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1262 xmin				28 0  4  -3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1262 cmin				29 0  4  -4 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1262 xmax				28 0  4  -5 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1262 cmax				29 0  4  -6 0 -1 -1 t f i f f));
-
-/* ----------------
- *		pg_proc
- * ----------------
- */
-#define Schema_pg_proc \
-{ 1255, {"proname"},			19, 0, NAMEDATALEN,  1, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
-{ 1255, {"proowner"},			23, 0,  4,  2, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1255, {"prolang"},			26, 0,  4,  3, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1255, {"proisinh"},			16, 0,  1,  4, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1255, {"proistrusted"},		16, 0,  1,  5, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1255, {"proiscachable"},		16, 0,  1,  6, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1255, {"pronargs"},			21, 0,  2,  7, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1255, {"proretset"},			16, 0,  1,  8, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1255, {"prorettype"},			26, 0,  4,  9, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1255, {"proargtypes"},		30, 0, 32, 10, 0, -1, -1,	'\0', '\0', 'i', '\0', '\0' }, \
-{ 1255, {"probyte_pct"},		23, 0,  4, 11, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1255, {"properbyte_cpu"},		23, 0,  4, 12, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1255, {"propercall_cpu"},		23, 0,  4, 13, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1255, {"prooutin_ratio"},		23, 0,  4, 14, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1255, {"prosrc"},				25, 0, -1,  15,	0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
-{ 1255, {"probin"},				17, 0, -1,  16,	0, -1, -1, '\0', '\0', 'i', '\0', '\0' }
-
-DATA(insert OID = 0 ( 1255 proname			19 0 NAMEDATALEN   1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1255 proowner			23 0  4   2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1255 prolang			26 0  4   3 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1255 proisinh			16 0  1   4 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1255 proistrusted		16 0  1   5 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1255 proiscachable	16 0  1   6 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1255 pronargs			21 0  2   7 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1255 proretset		16 0  1   8 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1255 prorettype		26 0  4   9 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1255 proargtypes		30 0 32  10 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1255 probyte_pct		23 0  4  11 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1255 properbyte_cpu	23 0  4  12 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1255 propercall_cpu	23 0  4  13 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1255 prooutin_ratio	23 0  4  14 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1255 prosrc			25 0 -1  15 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1255 probin			17 0 -1  16 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1255 ctid				27 0  6  -1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1255 oid				26 0  4  -2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1255 xmin				28 0  4  -3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1255 cmin				29 0  4  -4 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1255 xmax				28 0  4  -5 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1255 cmax				29 0  4  -6 0 -1 -1 t f i f f));
-
-/* ----------------
- *		pg_shadow
- * ----------------
- */
-DATA(insert OID = 0 ( 1260 usename		19	0 NAMEDATALEN	1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1260 usesysid		23	0	4	2 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1260 usecreatedb	16	0	1	3 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1260 usetrace		16	0	1	4 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1260 usesuper		16	0	1	5 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1260 usecatupd	16	0	1	6 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1260 passwd		25	0  -1	7 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1260 valuntil		702 0	4	8 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1260 ctid			27 0  6  -1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1260 oid			26 0  4  -2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1260 xmin			28 0  4  -3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1260 cmin			29 0  4  -4 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1260 xmax			28 0  4  -5 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1260 cmax			29 0  4  -6 0 -1 -1 t f i f f));
-
-/* ----------------
- *		pg_group
- * ----------------
- */
-DATA(insert OID = 0 ( 1261 groname			19 0 NAMEDATALEN  1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1261 grosysid			23 0  4   2 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1261 grolist		  1007 0 -1   3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1261 ctid				27 0  6  -1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1261 oid				26 0  4  -2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1261 xmin				28 0  4  -3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1261 cmin				29 0  4  -4 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1261 xmax				28 0  4  -5 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1261 cmax				29 0  4  -6 0 -1 -1 t f i f f));
-
-/* ----------------
- *		pg_attribute
- * ----------------
- */
-#define Schema_pg_attribute \
-{ 1249, {"attrelid"},	  26, 0,	4,	1, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1249, {"attname"},	  19, 0, NAMEDATALEN,	2, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
-{ 1249, {"atttypid"},	  26, 0,	4,	3, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1249, {"attdisbursion"}, 700, 0,	4,	4, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
-{ 1249, {"attlen"},		  21, 0,	2,	5, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1249, {"attnum"},		  21, 0,	2,	6, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1249, {"attnelems"},	  23, 0,	4,	7, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1249, {"attcacheoff"},  23, 0,	4,	8, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1249, {"atttypmod"},	  21, 0,	4,	9, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1249, {"attbyval"},	  16, 0,	1, 10, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1249, {"attisset"},	  16, 0,	1, 11, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1249, {"attalign"},	  18, 0,	1, 12, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1249, {"attnotnull"},  16, 0,	1, 13, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1249, {"atthasdef"},   16, 0,	1, 14, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }
-
-DATA(insert OID = 0 ( 1249 attrelid			26 0  4   1 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1249 attname			19 0 NAMEDATALEN  2 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1249 atttypid			26 0  4   3 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1249 attdisbursion   700 0  4   4 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1249 attlen			21 0  2   5 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1249 attnum			21 0  2   6 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1249 attnelems		23 0  4   7 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1249 attcacheoff		23 0  4   8 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1249 atttypmod		21 0  4   9 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1249 attbyval			16 0  1  10 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1249 attisset			16 0  1  11 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1249 attalign			18 0  1  12 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1249 attnotnull		16 0  1  13 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1249 atthasdef		16 0  1  14 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1249 ctid				27 0  6  -1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1249 oid				26 0  4  -2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1249 xmin				28 0  4  -3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1249 cmin				29 0  4  -4 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1249 xmax				28 0  4  -5 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1249 cmax				29 0  4  -6 0 -1 -1 t f i f f));
-
-/* ----------------
- *		pg_class
- * ----------------
- */
-#define Schema_pg_class \
-{ 1259, {"relname"},	   19, 0, NAMEDATALEN,  1, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
-{ 1259, {"reltype"},	   26, 0,	4,	2, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1259, {"relowner"},	   23, 0,	4,	3, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1259, {"relam"},		   26, 0,	4,	4, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1259, {"relpages"},	   23,	0,  4,  5, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1259, {"reltuples"},     23,	0,  4,  6, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1259, {"relhasindex"},   16,	0,  1,  7, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1259, {"relisshared"},   16,	0,  1,  8, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1259, {"relkind"},	   18,	0,  1,  9, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1259, {"relnatts"},	   21,	0,  2, 10, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1259, {"relchecks"},     21, 0,	2, 11, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1259, {"reltriggers"},   21, 0,	2, 12, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1259, {"relhasrules"},   16,	0,  1, 13, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1259, {"relacl"},	 	 1034, 0, -1, 14, 0, -1, -1,	'\0', '\0', 'i', '\0', '\0' }
-
-DATA(insert OID = 0 ( 1259 relname			19 0 NAMEDATALEN   1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1259 reltype			26 0  4   2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1259 relowner			23 0  4   3 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1259 relam			26 0  4   4 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1259 relpages			23 0  4   5 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1259 reltuples		23 0  4   6 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1259 relhasindex		16 0  1   7 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1259 relisshared		16 0  1   8 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1259 relkind			18 0  1   9 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1259 relnatts			21 0  2  10 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1259 relchecks		21 0  2  11 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1259 reltriggers		21 0  2  12 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1259 relhasrules		16 0  1  13 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1259 relacl		  1034 0 -1  14 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1259 ctid				27 0  6  -1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1259 oid				26 0  4  -2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1259 xmin				28 0  4  -3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1259 cmin				29 0  4  -4 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1259 xmax				28 0  4  -5 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1259 cmax				29 0  4  -6 0 -1 -1 t f i f f));
-
-/* ----------------
- *		pg_attrdef
- * ----------------
- */
-DATA(insert OID = 0 ( 1215 adrelid			26 0  4   1 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1215 adnum			21 0  2   2 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1215 adbin			25 0 -1   3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1215 adsrc			25 0 -1   4 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1215 ctid				27 0  6  -1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1215 oid				26 0  4  -2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1215 xmin				28 0  4  -3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1215 cmin				29 0  4  -4 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1215 xmax				28 0  4  -5 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1215 cmax				29 0  4  -6 0 -1 -1 t f i f f));
-
-/* ----------------
- *		pg_relcheck
- * ----------------
- */
-DATA(insert OID = 0 ( 1216 rcrelid			26 0  4   1 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1216 rcname			19 0  NAMEDATALEN  2 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1216 rcbin			25 0 -1   3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1216 rcsrc			25 0 -1   4 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1216 ctid				27 0  6  -1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1216 oid				26 0  4  -2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1216 xmin				28 0  4  -3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1216 cmin				29 0  4  -4 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1216 xmax				28 0  4  -5 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1216 cmax				29 0  4  -6 0 -1 -1 t f i f f));
-
-/* ----------------
- *		pg_trigger
- * ----------------
- */
-DATA(insert OID = 0 ( 1219 tgrelid			26 0  4   1 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1219 tgname			19 0  NAMEDATALEN  2 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1219 tgfoid			26 0  4   3 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1219 tgtype			21 0  2   4 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1219 tgnargs			21 0  2   5 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1219 tgattr			22 0 16   6 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1219 tgargs			17 0 -1   7 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1219 ctid				27 0  6  -1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1219 oid				26 0  4  -2 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1219 xmin				28 0  4  -3 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1219 cmin				29 0  4  -4 0 -1 -1 t f i f f));
-DATA(insert OID = 0 ( 1219 xmax				28 0  4  -5 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1219 cmax				29 0  4  -6 0 -1 -1 t f i f f));
-
-/* ----------------
- *		pg_variable - this relation is modified by special purpose access
- *				  method code.	The following is garbage but is needed
- *				  so that the reldesc code works properly.
- * ----------------
- */
-#define Schema_pg_variable \
-{ 1264, {"varfoo"},  26, 0, 4, 1, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }
-
-DATA(insert OID = 0 ( 1264 varfoo			26 0  4   1 0 -1 -1 t f i f f));
-
-/* ----------------
- *		pg_log - this relation is modified by special purpose access
- *				  method code.	The following is garbage but is needed
- *				  so that the reldesc code works properly.
- * ----------------
- */
-#define Schema_pg_log \
-{ 1269, {"logfoo"},  26, 0, 4, 1, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }
-
-DATA(insert OID = 0 ( 1269 logfoo			26 0  4   1 0 -1 -1 t f i f f));
-
-#endif							/* PG_ATTRIBUTE_H */
diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h
index 25f5ea223f9..4fe24603346 100644
--- a/src/include/catalog/pg_class.h
+++ b/src/include/catalog/pg_class.h
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_class.h,v 1.22 1998/08/11 18:28:43 momjian Exp $
+ * $Id: pg_class.h,v 1.23 1998/08/24 01:14:13 momjian Exp $
  *
  * NOTES
  *	  ``pg_relation'' is being replaced by ``pg_class''.  currently
@@ -130,7 +130,7 @@ DATA(insert OID = 1260 (  pg_shadow 86		  PGUID 0 0 0 f t r 8  0 0 f _null_ ));
 DESCR("");
 DATA(insert OID = 1261 (  pg_group 87		  PGUID 0 0 0 f t s 3  0 0 f _null_ ));
 DESCR("");
-DATA(insert OID = 1262 (  pg_database 88	  PGUID 0 0 0 f t r 3  0 0 f _null_ ));
+DATA(insert OID = 1262 (  pg_database 88	  PGUID 0 0 0 f t r 4  0 0 f _null_ ));
 DESCR("");
 DATA(insert OID = 1264 (  pg_variable 90	  PGUID 0 0 0 f t s 2  0 0 f _null_ ));
 DESCR("");
diff --git a/src/include/catalog/pg_class_mb.h b/src/include/catalog/pg_class_mb.h
deleted file mode 100644
index ea9249d1d65..00000000000
--- a/src/include/catalog/pg_class_mb.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * pg_class.h--
- *	  definition of the system "relation" relation (pg_class)
- *	  along with the relation's initial contents.
- *
- *
- * Copyright (c) 1994, Regents of the University of California
- *
- * $Id: pg_class_mb.h,v 1.4 1998/08/11 22:39:33 momjian Exp $
- *
- * NOTES
- *	  ``pg_relation'' is being replaced by ``pg_class''.  currently
- *	  we are only changing the name in the catalogs but someday the
- *	  code will be changed too. -cim 2/26/90
- *	  [it finally happens.	-ay 11/5/94]
- *
- *	  the genbki.sh script reads this file and generates .bki
- *	  information from the DATA() statements.
- *
- *-------------------------------------------------------------------------
- */
-#ifndef PG_RELATION_H
-#define PG_RELATION_H
-
-/* ----------------
- *		postgres.h contains the system type definintions and the
- *		CATALOG(), BOOTSTRAP and DATA() sugar words so this file
- *		can be read by both genbki.sh and the C compiler.
- * ----------------
- */
-
-/* ----------------
- *		pg_class definition.  cpp turns this into
- *		typedef struct FormData_pg_class
- *
- *		Note: the #if 0, #endif around the BKI_BEGIN.. END block
- *			  below keeps cpp from seeing what is meant for the
- *			  genbki script: pg_relation is now called pg_class, but
- *			  only in the catalogs -cim 2/26/90
- * ----------------
- */
-
-/* ----------------
- *		This structure is actually variable-length (the last attribute is
- *		a POSTGRES array).	Hence, sizeof(FormData_pg_class) does not
- *		describe the fixed-length or actual size of the structure.
- *		FormData_pg_class.relacl may not be correctly aligned, either,
- *		if aclitem and struct varlena don't align together.  Hence,
- *		you MUST use heap_getattr() to get the relacl field.
- * ----------------
- */
-CATALOG(pg_class) BOOTSTRAP
-{
-	NameData	relname;
-	Oid			reltype;
-	int4		relowner;
-	Oid			relam;
-	int4		relpages;
-	int4		reltuples;
-	bool		relhasindex;
-	bool		relisshared;
-	char		relkind;
-	int2		relnatts;
-
-	/*
-	 * relnatts is the number of user attributes this class has.  There
-	 * must be exactly this many instances in Class pg_attribute for this
-	 * class which have attnum > 0 (= user attribute).
-	 */
-	int2		relchecks;		/* # of CHECK constraints, not stored in
-								 * db? */
-	int2		reltriggers;	/* # of TRIGGERs */
-	bool		relhasrules;
-	aclitem		relacl[1];		/* this is here for the catalog */
-} FormData_pg_class;
-
-#define CLASS_TUPLE_SIZE \
-	 (offsetof(FormData_pg_class,relhasrules) + sizeof(bool))
-
-/* ----------------
- *		Form_pg_class corresponds to a pointer to a tuple with
- *		the format of pg_class relation.
- * ----------------
- */
-typedef FormData_pg_class *Form_pg_class;
-
-/* ----------------
- *		compiler constants for pg_class
- * ----------------
- */
-
-/* ----------------
- *		Natts_pg_class_fixed is used to tell routines that insert new
- *		pg_class tuples (as opposed to replacing old ones) that there's no
- *		relacl field.
- * ----------------
- */
-#define Natts_pg_class_fixed			13
-#define Natts_pg_class					14
-#define Anum_pg_class_relname			1
-#define Anum_pg_class_reltype			2
-#define Anum_pg_class_relowner			3
-#define Anum_pg_class_relam				4
-#define Anum_pg_class_relpages			5
-#define Anum_pg_class_reltuples			6
-#define Anum_pg_class_relhasindex		7
-#define Anum_pg_class_relisshared		8
-#define Anum_pg_class_relkind			9
-#define Anum_pg_class_relnatts			10
-#define Anum_pg_class_relchecks			11
-#define Anum_pg_class_reltriggers		12
-#define Anum_pg_class_relhasrules		13
-#define Anum_pg_class_relacl			14
-
-/* ----------------
- *		initial contents of pg_class
- * ----------------
- */
-
-DATA(insert OID = 1247 (  pg_type 71		  PGUID 0 0 0 f f r 16 0 0 f _null_ ));
-DESCR("");
-DATA(insert OID = 1249 (  pg_attribute 75	  PGUID 0 0 0 f f r 14 0 0 f _null_ ));
-DESCR("");
-DATA(insert OID = 1255 (  pg_proc 81		  PGUID 0 0 0 f f r 16 0 0 f _null_ ));
-DESCR("");
-DATA(insert OID = 1259 (  pg_class 83		  PGUID 0 0 0 f f r 14 0 0 f _null_ ));
-DESCR("");
-DATA(insert OID = 1260 (  pg_shadow 86		  PGUID 0 0 0 f t r 8  0 0 f _null_ ));
-DESCR("");
-DATA(insert OID = 1261 (  pg_group 87		  PGUID 0 0 0 f t s 3  0 0 f _null_ ));
-DESCR("");
-DATA(insert OID = 1262 (  pg_database 88	  PGUID 0 0 0 f t r 4  0 0 f _null_ ));
-DESCR("");
-DATA(insert OID = 1264 (  pg_variable 90	  PGUID 0 0 0 f t s 2  0 0 f _null_ ));
-DESCR("");
-DATA(insert OID = 1269 (  pg_log  99		  PGUID 0 0 0 f t s 1  0 0 f _null_ ));
-DESCR("");
-DATA(insert OID = 1215 (  pg_attrdef 109	  PGUID 0 0 0 t t r 4  0 0 f _null_ ));
-DESCR("");
-DATA(insert OID = 1216 (  pg_relcheck 110	  PGUID 0 0 0 t t r 4  0 0 f _null_ ));
-DESCR("");
-DATA(insert OID = 1219 (  pg_trigger 111	  PGUID 0 0 0 t t r 7  0 0 f _null_ ));
-DESCR("");
-
-#define RelOid_pg_type			1247
-#define RelOid_pg_attribute		1249
-#define RelOid_pg_proc			1255
-#define RelOid_pg_class			1259
-#define RelOid_pg_shadow		1260
-#define RelOid_pg_group			1261
-#define RelOid_pg_database		1262
-#define RelOid_pg_variable		1264
-#define RelOid_pg_log			1269
-#define RelOid_pg_attrdef		1215
-#define RelOid_pg_relcheck		1216
-#define RelOid_pg_trigger		1219
-
-#define		  RELKIND_INDEX			  'i'		/* secondary index */
-#define		  RELKIND_LOBJECT		  'l'		/* large objects */
-#define		  RELKIND_RELATION		  'r'		/* cataloged heap */
-#define		  RELKIND_SPECIAL		  's'		/* special (non-heap) */
-#define		  RELKIND_SEQUENCE		  'S'		/* SEQUENCE relation */
-#define		  RELKIND_UNCATALOGED	  'u'		/* temporary heap */
-
-#endif							/* PG_RELATION_H */
diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h
index 10015c7cc69..ef680941521 100644
--- a/src/include/catalog/pg_database.h
+++ b/src/include/catalog/pg_database.h
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_database.h,v 1.5 1997/09/08 02:35:04 momjian Exp $
+ * $Id: pg_database.h,v 1.6 1998/08/24 01:14:17 momjian Exp $
  *
  * NOTES
  *	  the genbki.sh script reads this file and generates .bki
@@ -34,9 +34,9 @@ CATALOG(pg_database) BOOTSTRAP
 {
 	NameData	datname;
 	int4		datdba;
+	int4		encoding;
 	text		datpath;		/* VARIABLE LENGTH FIELD */
 } FormData_pg_database;
-
 /* ----------------
  *		Form_pg_database corresponds to a pointer to a tuple with
  *		the format of pg_database relation.
@@ -48,10 +48,9 @@ typedef FormData_pg_database *Form_pg_database;
  *		compiler constants for pg_database
  * ----------------
  */
-#define Natts_pg_database				3
+#define Natts_pg_database				4
 #define Anum_pg_database_datname		1
 #define Anum_pg_database_datdba			2
-#define Anum_pg_database_datpath		3
-
-
+#define Anum_pg_database_encoding		3
+#define Anum_pg_database_datpath		4
 #endif							/* PG_DATABASE_H */
diff --git a/src/include/catalog/pg_database_mb.h b/src/include/catalog/pg_database_mb.h
deleted file mode 100644
index 0b778a5d509..00000000000
--- a/src/include/catalog/pg_database_mb.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * pg_database.h--
- *	  definition of the system "database" relation (pg_database)
- *	  along with the relation's initial contents.
- *
- *
- * Copyright (c) 1994, Regents of the University of California
- *
- * $Id: pg_database_mb.h,v 1.2 1998/08/06 05:13:09 momjian Exp $
- *
- * NOTES
- *	  the genbki.sh script reads this file and generates .bki
- *	  information from the DATA() statements.
- *
- *-------------------------------------------------------------------------
- */
-#ifndef PG_DATABASE_H
-#define PG_DATABASE_H
-
-/* ----------------
- *		postgres.h contains the system type definintions and the
- *		CATALOG(), BOOTSTRAP and DATA() sugar words so this file
- *		can be read by both genbki.sh and the C compiler.
- * ----------------
- */
-
-/* ----------------
- *		pg_database definition.  cpp turns this into
- *		typedef struct FormData_pg_database
- * ----------------
- */
-CATALOG(pg_database) BOOTSTRAP
-{
-	NameData	datname;
-	int4		datdba;
-	int4		encoding;
-	text		datpath;		/* VARIABLE LENGTH FIELD */
-} FormData_pg_database;
-/* ----------------
- *		Form_pg_database corresponds to a pointer to a tuple with
- *		the format of pg_database relation.
- * ----------------
- */
-typedef FormData_pg_database *Form_pg_database;
-
-/* ----------------
- *		compiler constants for pg_database
- * ----------------
- */
-#define Natts_pg_database				4
-#define Anum_pg_database_datname		1
-#define Anum_pg_database_datdba			2
-#define Anum_pg_database_encoding		3
-#define Anum_pg_database_datpath		4
-#endif							/* PG_DATABASE_H */
diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h
index 2b0da3114df..0ee47857c8a 100644
--- a/src/include/commands/dbcommands.h
+++ b/src/include/commands/dbcommands.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: dbcommands.h,v 1.4 1998/07/26 04:31:23 scrappy Exp $
+ * $Id: dbcommands.h,v 1.5 1998/08/24 01:14:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,11 +19,7 @@
  */
 #define SIGKILLDAEMON1	SIGTERM
 
-#ifdef MULTIBYTE
 extern void createdb(char *dbname, char *dbpath, int encoding);
-#else
-extern void createdb(char *dbname, char *dbpath);
-#endif
 extern void destroydb(char *dbname);
 
 #endif							/* DBCOMMANDS_H */
diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h
index 41bbd97731c..aec1ad06a91 100644
--- a/src/include/mb/pg_wchar.h
+++ b/src/include/mb/pg_wchar.h
@@ -1,4 +1,4 @@
-/* $Id: pg_wchar.h,v 1.2 1998/07/26 04:31:26 scrappy Exp $ */
+/* $Id: pg_wchar.h,v 1.3 1998/08/24 01:14:22 momjian Exp $ */
 
 #ifndef PG_WCHAR_H
 #define PG_WCHAR_H
@@ -7,21 +7,22 @@
 #include "postgres.h"
 #include "miscadmin.h"	/* for getdatabaseencoding() */
 
-#define EUC_JP 0	/* EUC for Japanese */
-#define EUC_CN 1	/* EUC for Chinese */
-#define EUC_KR 2	/* EUC for Korean */
+#define SQL_ASCII 0	/* SQL/ASCII */
+#define EUC_JP 1	/* EUC for Japanese */
+#define EUC_CN 2	/* EUC for Chinese */
+#define EUC_KR 3	/* EUC for Korean */
 #define EUC_TW 3	/* EUC for Taiwan */
-#define UNICODE 4	/* Unicode UTF-8 */
-#define MULE_INTERNAL 5	/* Mule internal code */
-#define LATIN1 6	/* ISO-8859 Latin 1 */
-#define LATIN2 7	/* ISO-8859 Latin 2 */
-#define LATIN3 8	/* ISO-8859 Latin 3 */
-#define LATIN4 9	/* ISO-8859 Latin 4 */
-#define LATIN5 10	/* ISO-8859 Latin 5 */
-#define LATIN6 11	/* ISO-8859 Latin 6 */
-#define LATIN7 12	/* ISO-8859 Latin 7 */
-#define LATIN8 13	/* ISO-8859 Latin 8 */
-#define LATIN9 14	/* ISO-8859 Latin 9 */
+#define UNICODE 5	/* Unicode UTF-8 */
+#define MULE_INTERNAL 6	/* Mule internal code */
+#define LATIN1 7	/* ISO-8859 Latin 1 */
+#define LATIN2 8	/* ISO-8859 Latin 2 */
+#define LATIN3 9	/* ISO-8859 Latin 3 */
+#define LATIN4 10	/* ISO-8859 Latin 4 */
+#define LATIN5 11	/* ISO-8859 Latin 5 */
+#define LATIN6 12	/* ISO-8859 Latin 6 */
+#define LATIN7 13	/* ISO-8859 Latin 7 */
+#define LATIN8 14	/* ISO-8859 Latin 8 */
+#define LATIN9 15	/* ISO-8859 Latin 9 */
 /* followings are for client encoding only */
 #define SJIS 32		/* Shift JIS */
 
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index c8c5e2dfd76..3183185ca31 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -11,7 +11,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: miscadmin.h,v 1.30 1998/08/11 18:28:33 momjian Exp $
+ * $Id: miscadmin.h,v 1.31 1998/08/24 01:14:07 momjian Exp $
  *
  * NOTES
  *	  some of the information in this file will be moved to
@@ -116,11 +116,7 @@ extern char *DatabaseName;
 extern char *DatabasePath;
 
 /* in utils/misc/database.c */
-#ifdef MULTIBYTE
 extern void GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encoding);
-#else
-extern void GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path);
-#endif
 extern int	GetDatabaseInfo(char *name, int4 *owner, char *path);
 extern char *ExpandDatabasePath(char *path);
 
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 6244a0797dd..7d3545bde22 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsenodes.h,v 1.54 1998/08/10 02:26:37 momjian Exp $
+ * $Id: parsenodes.h,v 1.55 1998/08/24 01:14:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -480,10 +480,8 @@ typedef struct CreatedbStmt
 	NodeTag		type;
 	char	   *dbname;			/* database to create */
 	char	   *dbpath;			/* location of database */
-#ifdef MULTIBYTE
 	int	   encoding;			/* default encoding
 						   (see regex/pg_wchar.h) */
-#endif
 } CreatedbStmt;
 
 /* ----------------------
-- 
GitLab