*** postgresql-7.0.2/src/backend/parser/analyze.c.orig Thu Aug 3 08:46:58 2000 --- postgresql-7.0.2/src/backend/parser/analyze.c Thu Aug 3 10:28:59 2000 *************** *** 28,33 **** --- 28,37 ---- #include "utils/builtins.h" #include "utils/numeric.h" + #ifdef MULTIBYTE + #include "mb/pg_wchar.h" + #endif + void CheckSelectForUpdate(Query *qry); /* no points for style... */ static Query *transformStmt(ParseState *pstate, Node *stmt); *************** *** 533,538 **** --- 537,549 ---- else name2chars--; } + + #ifdef MULTIBYTE + if (name1) + name1chars = pg_mbcliplen(name1, name1chars, name1chars); + if (name2) + name2chars = pg_mbcliplen(name2, name2chars, name2chars); + #endif /* Now construct the string using the chosen lengths */ name = palloc(name1chars + name2chars + overhead + 1); *** postgresql-7.0.2/src/backend/parser/scan.l.orig Thu Aug 3 09:00:14 2000 --- postgresql-7.0.2/src/backend/parser/scan.l Thu Aug 3 09:09:25 2000 *************** *** 31,36 **** --- 31,40 ---- #include "parser/scansup.h" #include "utils/builtins.h" + #ifdef MULTIBYTE + #include "mb/pg_wchar.h" + #endif + extern char *parseString; static char *parseCh; *************** *** 328,336 **** --- 332,348 ---- BEGIN(INITIAL); if (strlen(literalbuf) >= NAMEDATALEN) { + #ifdef MULTIBYTE + int len; + len = pg_mbcliplen(literalbuf,strlen(literalbuf),NAMEDATALEN-1); + elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"", + literalbuf, len, literalbuf); + literalbuf[len] = '\0'; + #else elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"", literalbuf, NAMEDATALEN-1, literalbuf); literalbuf[NAMEDATALEN-1] = '\0'; + #endif } yylval.str = pstrdup(literalbuf); return IDENT; *************** *** 451,459 **** --- 463,479 ---- yytext[i] = tolower(yytext[i]); if (i >= NAMEDATALEN) { + #ifdef MULTIBYTE + int len; + len = pg_mbcliplen(yytext,i,NAMEDATALEN-1); + elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"", + yytext, len, yytext); + yytext[len] = '\0'; + #else elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"", yytext, NAMEDATALEN-1, yytext); yytext[NAMEDATALEN-1] = '\0'; + #endif } keyword = ScanKeywordLookup((char*)yytext); if (keyword != NULL) { *** postgresql-7.0.2/src/backend/parser/scan.c.orig Tue Jun 6 03:16:18 2000 --- postgresql-7.0.2/src/backend/parser/scan.c Thu Aug 3 09:09:29 2000 *************** *** 2,8 **** /* Scanner skeleton version: * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ - * $FreeBSD: src/usr.bin/lex/flex.skl,v 1.4 1999/10/27 07:56:44 obrien Exp $ */ #define FLEX_SCANNER --- 2,7 ---- *************** *** 568,573 **** --- 567,576 ---- #include "parser/scansup.h" #include "utils/builtins.h" + #ifdef MULTIBYTE + #include "mb/pg_wchar.h" + #endif + extern char *parseString; static char *parseCh; *************** *** 719,725 **** * Note that xcstart must appear before operator, as explained above! * Also whitespace (comment) must appear before operator. */ ! #line 723 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. --- 722,728 ---- * Note that xcstart must appear before operator, as explained above! * Also whitespace (comment) must appear before operator. */ ! #line 726 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. *************** *** 870,878 **** register char *yy_cp, *yy_bp; register int yy_act; ! #line 246 "scan.l" ! #line 876 "lex.yy.c" if ( yy_init ) { --- 873,881 ---- register char *yy_cp, *yy_bp; register int yy_act; ! #line 250 "scan.l" ! #line 879 "lex.yy.c" if ( yy_init ) { *************** *** 957,968 **** case 1: YY_RULE_SETUP ! #line 247 "scan.l" { /* ignore */ } YY_BREAK case 2: YY_RULE_SETUP ! #line 249 "scan.l" { BEGIN(xc); /* Put back any characters past slash-star; see above */ --- 960,971 ---- case 1: YY_RULE_SETUP ! #line 251 "scan.l" { /* ignore */ } YY_BREAK case 2: YY_RULE_SETUP ! #line 253 "scan.l" { BEGIN(xc); /* Put back any characters past slash-star; see above */ *************** *** 971,991 **** YY_BREAK case 3: YY_RULE_SETUP ! #line 255 "scan.l" { BEGIN(INITIAL); } YY_BREAK case 4: YY_RULE_SETUP ! #line 257 "scan.l" { /* ignore */ } YY_BREAK case YY_STATE_EOF(xc): ! #line 259 "scan.l" { elog(ERROR, "Unterminated /* comment"); } YY_BREAK case 5: YY_RULE_SETUP ! #line 261 "scan.l" { BEGIN(xb); startlit(); --- 974,994 ---- YY_BREAK case 3: YY_RULE_SETUP ! #line 259 "scan.l" { BEGIN(INITIAL); } YY_BREAK case 4: YY_RULE_SETUP ! #line 261 "scan.l" { /* ignore */ } YY_BREAK case YY_STATE_EOF(xc): ! #line 263 "scan.l" { elog(ERROR, "Unterminated /* comment"); } YY_BREAK case 5: YY_RULE_SETUP ! #line 265 "scan.l" { BEGIN(xb); startlit(); *************** *** 993,999 **** YY_BREAK case 6: YY_RULE_SETUP ! #line 265 "scan.l" { char* endptr; --- 996,1002 ---- YY_BREAK case 6: YY_RULE_SETUP ! #line 269 "scan.l" { char* endptr; *************** *** 1007,1036 **** } YY_BREAK case 7: ! #line 277 "scan.l" case 8: YY_RULE_SETUP ! #line 277 "scan.l" { addlit(yytext, yyleng); } YY_BREAK case 9: ! #line 281 "scan.l" case 10: YY_RULE_SETUP ! #line 281 "scan.l" { /* ignore */ } YY_BREAK case YY_STATE_EOF(xb): ! #line 284 "scan.l" { elog(ERROR, "Unterminated binary integer"); } YY_BREAK case 11: YY_RULE_SETUP ! #line 286 "scan.l" { BEGIN(xh); startlit(); --- 1010,1039 ---- } YY_BREAK case 7: ! #line 281 "scan.l" case 8: YY_RULE_SETUP ! #line 281 "scan.l" { addlit(yytext, yyleng); } YY_BREAK case 9: ! #line 285 "scan.l" case 10: YY_RULE_SETUP ! #line 285 "scan.l" { /* ignore */ } YY_BREAK case YY_STATE_EOF(xb): ! #line 288 "scan.l" { elog(ERROR, "Unterminated binary integer"); } YY_BREAK case 11: YY_RULE_SETUP ! #line 290 "scan.l" { BEGIN(xh); startlit(); *************** *** 1038,1044 **** YY_BREAK case 12: YY_RULE_SETUP ! #line 290 "scan.l" { char* endptr; --- 1041,1047 ---- YY_BREAK case 12: YY_RULE_SETUP ! #line 294 "scan.l" { char* endptr; *************** *** 1052,1063 **** } YY_BREAK case YY_STATE_EOF(xh): ! #line 301 "scan.l" { elog(ERROR, "Unterminated hexadecimal integer"); } YY_BREAK case 13: YY_RULE_SETUP ! #line 303 "scan.l" { BEGIN(xq); startlit(); --- 1055,1066 ---- } YY_BREAK case YY_STATE_EOF(xh): ! #line 305 "scan.l" { elog(ERROR, "Unterminated hexadecimal integer"); } YY_BREAK case 13: YY_RULE_SETUP ! #line 307 "scan.l" { BEGIN(xq); startlit(); *************** *** 1065,1071 **** YY_BREAK case 14: YY_RULE_SETUP ! #line 307 "scan.l" { BEGIN(INITIAL); yylval.str = scanstr(literalbuf); --- 1068,1074 ---- YY_BREAK case 14: YY_RULE_SETUP ! #line 311 "scan.l" { BEGIN(INITIAL); yylval.str = scanstr(literalbuf); *************** *** 1073,1102 **** } YY_BREAK case 15: ! #line 313 "scan.l" case 16: ! #line 314 "scan.l" case 17: YY_RULE_SETUP ! #line 314 "scan.l" { addlit(yytext, yyleng); } YY_BREAK case 18: YY_RULE_SETUP ! #line 317 "scan.l" { /* ignore */ } YY_BREAK case YY_STATE_EOF(xq): ! #line 320 "scan.l" { elog(ERROR, "Unterminated quoted string"); } YY_BREAK case 19: YY_RULE_SETUP ! #line 323 "scan.l" { BEGIN(xd); startlit(); --- 1076,1105 ---- } YY_BREAK case 15: ! #line 317 "scan.l" case 16: ! #line 318 "scan.l" case 17: YY_RULE_SETUP ! #line 318 "scan.l" { addlit(yytext, yyleng); } YY_BREAK case 18: YY_RULE_SETUP ! #line 321 "scan.l" { /* ignore */ } YY_BREAK case YY_STATE_EOF(xq): ! #line 324 "scan.l" { elog(ERROR, "Unterminated quoted string"); } YY_BREAK case 19: YY_RULE_SETUP ! #line 327 "scan.l" { BEGIN(xd); startlit(); *************** *** 1104,1117 **** YY_BREAK case 20: YY_RULE_SETUP ! #line 327 "scan.l" { BEGIN(INITIAL); if (strlen(literalbuf) >= NAMEDATALEN) { elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"", literalbuf, NAMEDATALEN-1, literalbuf); literalbuf[NAMEDATALEN-1] = '\0'; } yylval.str = pstrdup(literalbuf); return IDENT; --- 1107,1128 ---- YY_BREAK case 20: YY_RULE_SETUP ! #line 331 "scan.l" { BEGIN(INITIAL); if (strlen(literalbuf) >= NAMEDATALEN) { + #ifdef MULTIBYTE + int len; + len = pg_mbcliplen(literalbuf,strlen(literalbuf),NAMEDATALEN-1); + elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"", + literalbuf, len, literalbuf); + literalbuf[len] = '\0'; + #else elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"", literalbuf, NAMEDATALEN-1, literalbuf); literalbuf[NAMEDATALEN-1] = '\0'; + #endif } yylval.str = pstrdup(literalbuf); return IDENT; *************** *** 1119,1146 **** YY_BREAK case 21: YY_RULE_SETUP ! #line 338 "scan.l" { addlit(yytext, yyleng); } YY_BREAK case YY_STATE_EOF(xd): ! #line 341 "scan.l" { elog(ERROR, "Unterminated quoted identifier"); } YY_BREAK case 22: YY_RULE_SETUP ! #line 343 "scan.l" { return TYPECAST; } YY_BREAK case 23: YY_RULE_SETUP ! #line 345 "scan.l" { return yytext[0]; } YY_BREAK case 24: YY_RULE_SETUP ! #line 347 "scan.l" { /* * Check for embedded slash-star or dash-dash; those --- 1130,1157 ---- YY_BREAK case 21: YY_RULE_SETUP ! #line 350 "scan.l" { addlit(yytext, yyleng); } YY_BREAK case YY_STATE_EOF(xd): ! #line 353 "scan.l" { elog(ERROR, "Unterminated quoted identifier"); } YY_BREAK case 22: YY_RULE_SETUP ! #line 355 "scan.l" { return TYPECAST; } YY_BREAK case 23: YY_RULE_SETUP ! #line 357 "scan.l" { return yytext[0]; } YY_BREAK case 24: YY_RULE_SETUP ! #line 359 "scan.l" { /* * Check for embedded slash-star or dash-dash; those *************** *** 1212,1218 **** YY_BREAK case 25: YY_RULE_SETUP ! #line 416 "scan.l" { yylval.ival = atol((char*)&yytext[1]); return PARAM; --- 1223,1229 ---- YY_BREAK case 25: YY_RULE_SETUP ! #line 428 "scan.l" { yylval.ival = atol((char*)&yytext[1]); return PARAM; *************** *** 1220,1226 **** YY_BREAK case 26: YY_RULE_SETUP ! #line 421 "scan.l" { char* endptr; --- 1231,1237 ---- YY_BREAK case 26: YY_RULE_SETUP ! #line 433 "scan.l" { char* endptr; *************** *** 1237,1243 **** YY_BREAK case 27: YY_RULE_SETUP ! #line 434 "scan.l" { yylval.str = pstrdup((char*)yytext); return FCONST; --- 1248,1254 ---- YY_BREAK case 27: YY_RULE_SETUP ! #line 446 "scan.l" { yylval.str = pstrdup((char*)yytext); return FCONST; *************** *** 1245,1251 **** YY_BREAK case 28: YY_RULE_SETUP ! #line 438 "scan.l" { yylval.str = pstrdup((char*)yytext); return FCONST; --- 1256,1262 ---- YY_BREAK case 28: YY_RULE_SETUP ! #line 450 "scan.l" { yylval.str = pstrdup((char*)yytext); return FCONST; *************** *** 1253,1259 **** YY_BREAK case 29: YY_RULE_SETUP ! #line 444 "scan.l" { int i; ScanKeyword *keyword; --- 1264,1270 ---- YY_BREAK case 29: YY_RULE_SETUP ! #line 456 "scan.l" { int i; ScanKeyword *keyword; *************** *** 1264,1272 **** --- 1275,1291 ---- yytext[i] = tolower(yytext[i]); if (i >= NAMEDATALEN) { + #ifdef MULTIBYTE + int len; + len = pg_mbcliplen(yytext,i,NAMEDATALEN-1); + elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"", + yytext, len, yytext); + yytext[len] = '\0'; + #else elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"", yytext, NAMEDATALEN-1, yytext); yytext[NAMEDATALEN-1] = '\0'; + #endif } keyword = ScanKeywordLookup((char*)yytext); if (keyword != NULL) { *************** *** 1281,1295 **** YY_BREAK case 30: YY_RULE_SETUP ! #line 469 "scan.l" { return yytext[0]; } YY_BREAK case 31: YY_RULE_SETUP ! #line 471 "scan.l" ECHO; YY_BREAK ! #line 1293 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); --- 1300,1314 ---- YY_BREAK case 30: YY_RULE_SETUP ! #line 489 "scan.l" { return yytext[0]; } YY_BREAK case 31: YY_RULE_SETUP ! #line 491 "scan.l" ECHO; YY_BREAK ! #line 1312 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); *************** *** 2175,2181 **** return 0; } #endif ! #line 471 "scan.l" void yyerror(const char * message) --- 2194,2200 ---- return 0; } #endif ! #line 491 "scan.l" void yyerror(const char * message)