Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0b0146

Browse files
committed
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 (afterBruce's massive patch, I think) BTW, I noticed that after runningregression, the oid field of pg_type seems disappeared.regression=> select oid from pg_type; ERROR: attribute'oid' not foundthis happens after the constraints test. This occures with/withoutmy patches. strange...o pg_database_mb.h, pg_class_mb.h, pg_attribute_mb.h are no longerused, and shoud be removed.o GetDatabaseInfo() in utils/misc/database.c removed (actually in#ifdef 0). seems nobody uses.t-ishii@sra.co.jp
1 parent9438fe5 commitc0b0146

File tree

27 files changed

+171
-815
lines changed

27 files changed

+171
-815
lines changed

‎src/backend/bootstrap/bootparse.y

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.20 1998/08/19 02:01:23 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.21 1998/08/2401:13:36 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -31,13 +31,8 @@
3131
#include"bootstrap/bootstrap.h"
3232
#include"catalog/heap.h"
3333
#include"catalog/pg_am.h"
34-
#ifdef MULTIBYTE
35-
#include"catalog/pg_attribute_mb.h"
36-
#include"catalog/pg_class_mb.h"
37-
#else
3834
#include"catalog/pg_attribute.h"
3935
#include"catalog/pg_class.h"
40-
#endif
4136
#include"commands/defrem.h"
4237
#include"nodes/nodes.h"
4338
#include"nodes/parsenodes.h"

‎src/backend/bootstrap/bootscanner.l

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.10 1998/07/26 04:30:19 scrappy Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.11 1998/08/24 01:13:38 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -20,23 +20,15 @@
2020
#include"storage/block.h"
2121
#include"storage/off.h"
2222
#include"storage/itemptr.h"
23-
#ifdef MULTIBYTE
24-
#include"catalog/pg_attribute_mb.h"
25-
#else
2623
#include"catalog/pg_attribute.h"
27-
#endif
2824
#include"access/attnum.h"
2925
#include"nodes/pg_list.h"
3026
#include"access/tupdesc.h"
3127
#include"access/itup.h"
3228
#include"access/funcindex.h"
3329
#include"storage/fd.h"
3430
#include"catalog/pg_am.h"
35-
#ifdef MULTIBYTE
36-
#include"catalog/pg_class_mb.h"
37-
#else
3831
#include"catalog/pg_class.h"
39-
#endif
4032
#include"nodes/nodes.h"
4133
#include"rewrite/prs2lock.h"
4234
#include"access/skey.h"

‎src/backend/commands/copy.c

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.53 1998/08/19 02:01:44 momjian Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.54 1998/08/2401:13:39 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -37,6 +37,10 @@
3737
#include"commands/trigger.h"
3838
#include<storage/fd.h>
3939

40+
#ifdefMULTIBYTE
41+
#include"mb/pg_wchar.h"
42+
#endif
43+
4044
#defineISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
4145
#defineVALUE(c) ((c) - '0')
4246

@@ -61,7 +65,7 @@ static char *CopyReadAttribute(FILE *fp, bool *isnull, char *delim, int *newline
6165
staticchar*CopyReadAttribute(FILE*fp,bool*isnull,char*delim);
6266

6367
#endif
64-
staticvoidCopyAttributeOut(FILE*fp,char*string,char*delim,intis_array);
68+
staticvoidCopyAttributeOut(FILE*fp,unsignedchar*string,char*delim,intis_array);
6569
staticintCountTuples(Relationrelation);
6670

6771
externFILE*Pfout,
@@ -1006,6 +1010,17 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
10061010
charc;
10071011
intdone=0;
10081012
inti=0;
1013+
#ifdefMULTIBYTE
1014+
intmblen;
1015+
intencoding;
1016+
unsignedchars[2];
1017+
intj;
1018+
#endif
1019+
1020+
#ifdefMULTIBYTE
1021+
encoding=pg_get_client_encoding();
1022+
s[1]=0;
1023+
#endif
10091024

10101025
#ifdefCOPY_PATCH
10111026
/* if last delimiter was a newline return a NULL attribute */
@@ -1108,19 +1123,53 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
11081123
}
11091124
if (!done)
11101125
attribute[i++]=c;
1126+
#ifdefMULTIBYTE
1127+
s[0]=c;
1128+
mblen=pg_encoding_mblen(encoding,s);
1129+
mblen--;
1130+
for(j=0;j<mblen;j++) {
1131+
c=getc(fp);
1132+
if (feof(fp))
1133+
return (NULL);
1134+
attribute[i++]=c;
1135+
}
1136+
#endif
11111137
if (i==EXT_ATTLEN-1)
11121138
elog(ERROR,"CopyReadAttribute - attribute length too long. line: %d",lineno);
11131139
}
11141140
attribute[i]='\0';
1141+
#ifdefMULTIBYTE
1142+
return(pg_client_to_server((unsignedchar*)attribute,strlen(attribute)));
1143+
#else
11151144
return (&attribute[0]);
1145+
#endif
11161146
}
11171147

11181148
staticvoid
1119-
CopyAttributeOut(FILE*fp,char*string,char*delim,intis_array)
1149+
CopyAttributeOut(FILE*fp,unsignedchar*server_string,char*delim,intis_array)
11201150
{
1151+
unsignedchar*string;
11211152
charc;
11221153

1154+
#ifdefMULTIBYTE
1155+
intmblen;
1156+
intencoding;
1157+
inti;
1158+
#endif
1159+
1160+
#ifdefMULTIBYTE
1161+
string=pg_server_to_client(server_string,strlen(server_string));
1162+
encoding=pg_get_client_encoding();
1163+
#else
1164+
string=server_string;
1165+
#endif
1166+
1167+
#ifdefMULTIBYTE
1168+
for (; (mblen=pg_encoding_mblen(encoding,string))&&
1169+
((c=*string)!='\0');string+=mblen)
1170+
#else
11231171
for (; (c=*string)!='\0';string++)
1172+
#endif
11241173
{
11251174
if (c==delim[0]||c=='\n'||
11261175
(c=='\\'&& !is_array))
@@ -1142,7 +1191,13 @@ CopyAttributeOut(FILE *fp, char *string, char *delim, int is_array)
11421191
fputc('\\',fp);
11431192
}
11441193
}
1194+
#ifdefMULTIBYTE
1195+
for (i=0;i<mblen;i++) {
1196+
fputc(*(string+i),fp);
1197+
}
1198+
#else
11451199
fputc(*string,fp);
1200+
#endif
11461201
}
11471202
}
11481203

‎src/backend/commands/dbcommands.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.20 1998/08/19 02:01:46 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.21 1998/08/2401:13:40 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -43,7 +43,7 @@ static HeapTuple get_pg_dbtup(char *command, char *dbname, Relation dbrel);
4343
staticvoidstop_vacuum(char*dbpath,char*dbname);
4444

4545
void
46-
createdb(char*dbname,char*dbpath)
46+
createdb(char*dbname,char*dbpath,intencoding)
4747
{
4848
Oiddb_id,
4949
user_id;
@@ -90,8 +90,9 @@ createdb(char *dbname, char *dbpath)
9090
dbname,user_id,dbname);
9191
#endif
9292

93-
sprintf(buf,"insert into pg_database (datname, datdba, datpath)"
94-
" values (\'%s\', \'%d\', \'%s\');",dbname,user_id,loc);
93+
sprintf(buf,"insert into pg_database (datname, datdba, encoding, datpath)"
94+
" values (\'%s\', \'%d\', \'%d\', \'%s\');",dbname,user_id,encoding,loc);
95+
9596

9697
pg_exec_query(buf);
9798
}

‎src/backend/commands/rename.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.14 1998/08/19 02:01:52 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.15 1998/08/2401:13:42 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -31,11 +31,7 @@
3131
#include<utils/excid.h>
3232
#include<utils/mcxt.h>
3333
#include<catalog/pg_proc.h>
34-
#ifdefMULTIBYTE
35-
#include<catalog/pg_class_mb.h>
36-
#else
3734
#include<catalog/pg_class.h>
38-
#endif
3935
#include<optimizer/internal.h>
4036
#include<optimizer/prep.h>/* for find_all_inheritors */
4137
#ifndefNO_SECURITY

‎src/backend/parser/gram.y

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.23 1998/08/18 00:48:55 scrappy Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.24 1998/08/24 01:13:44 momjian Exp $
1414
*
1515
* HISTORY
1616
* AUTHORDATEMAJOR EVENT
@@ -2142,6 +2142,7 @@ CreatedbStmt: CREATE DATABASE database_name WITH opt_database1 opt_database2
21422142
#else
21432143
if ($6 != NULL)
21442144
elog(ERROR, "WITH ENCODING is not supported");
2145+
n->encoding = 0;
21452146
#endif
21462147
$$ = (Node *)n;
21472148
}
@@ -2152,6 +2153,8 @@ CreatedbStmt: CREATE DATABASE database_name WITH opt_database1 opt_database2
21522153
n->dbpath = NULL;
21532154
#ifdef MULTIBYTE
21542155
n->encoding = GetTemplateEncoding();
2156+
#else
2157+
n->encoding = 0;
21552158
#endif
21562159
$$ = (Node *)n;
21572160
}

‎src/backend/storage/lmgr/lmgr.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.17 1998/08/19 02:02:40 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.18 1998/08/24 01:13:46 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -41,11 +41,7 @@
4141

4242
#include"catalog/catname.h"
4343
#include"catalog/catalog.h"
44-
#ifdefMULTIBYTE
45-
#include"catalog/pg_class_mb.h"
46-
#else
4744
#include"catalog/pg_class.h"
48-
#endif
4945

5046
#include"nodes/memnodes.h"
5147
#include"storage/bufmgr.h"

‎src/backend/storage/smgr/md.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.36 1998/08/11 18:28:15 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.37 1998/08/24 01:13:48 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -568,15 +568,9 @@ mdblindwrt(char *dbstr,
568568
int4owner;
569569
Oidid;
570570
char*tmpPath;
571-
#ifdefMULTIBYTE
572571
inttmpEncoding;
573-
#endif
574572

575-
#ifdefMULTIBYTE
576573
GetRawDatabaseInfo(dbstr,&owner,&id,dbpath,&tmpEncoding);
577-
#else
578-
GetRawDatabaseInfo(dbstr,&owner,&id,dbpath);
579-
#endif
580574

581575
if (id!=dbid)
582576
elog(FATAL,"mdblindwrt: oid of db %s is not %u",dbstr,dbid);
@@ -613,16 +607,9 @@ mdblindwrt(char *dbstr,
613607
int4owner;
614608
Oidid;
615609
char*tmpPath;
616-
617-
#ifdefMULTIBYTE
618610
inttmpEncoding;
619-
#endif
620611

621-
#ifdefMULTIBYTE
622612
GetRawDatabaseInfo(dbstr,&owner,&id,dbpath,&tmpEncoding);
623-
#else
624-
GetRawDatabaseInfo(dbstr,&owner,&id,dbpath);
625-
#endif
626613

627614
if (id!=dbid)
628615
elog(FATAL,"mdblindwrt: oid of db %s is not %u",dbstr,dbid);

‎src/backend/tcop/utility.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.45 1998/08/06 05:12:48 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.46 1998/08/24 01:13:50 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -558,11 +558,7 @@ ProcessUtility(Node *parsetree,
558558

559559
*ps_status=commandTag="CREATEDB";
560560
CHECK_IF_ABORTED();
561-
#ifdefMULTIBYTE
562561
createdb(stmt->dbname,stmt->dbpath,stmt->encoding);
563-
#else
564-
createdb(stmt->dbname,stmt->dbpath);
565-
#endif
566562
}
567563
break;
568564

‎src/backend/utils/cache/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44
# Makefile for utils/cache
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/utils/cache/Makefile,v 1.8 1998/07/26 04:30:54 scrappy Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/utils/cache/Makefile,v 1.9 1998/08/24 01:13:52 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
SRCDIR = ../../..
1212
include ../../../Makefile.global
1313

1414
CFLAGS += -I../..
15-
ifdefMULTIBYTE
16-
CFLAGS+=$(MBFLAGS)
17-
endif
1815

1916
OBJS = catcache.o inval.o rel.o relcache.o syscache.o lsyscache.o fcache.o
2017

‎src/backend/utils/cache/fcache.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.15 1998/08/19 02:03:09 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.16 1998/08/24 01:13:54 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -22,11 +22,7 @@
2222
#include"catalog/pg_type.h"
2323
#include"catalog/pg_proc.h"
2424
#include"catalog/pg_language.h"
25-
#ifdefMULTIBYTE
26-
#include"catalog/pg_class_mb.h"
27-
#else
2825
#include"catalog/pg_class.h"
29-
#endif
3026
#include"parser/parsetree.h"/* for getrelname() */
3127
#include"utils/builtins.h"
3228
#include"utils/fcache.h"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp