From: Oleg Bartunov <oleg@sai.msu.su>

Subject: [HACKERS] locale patches !

Hi there,

here are little patches to get Postgres 6.1 works with locale stuff.
This is a patch against 970402.tar.gz, there are no problem to apply them
by hand to 6.0 release. Collate stuff tested about 1-2 months in real
working database but I'm sure there must be no problem. US hackers
could vote against locale implementation ( locale for sure will affect to
speed of postgres ), so I introduce variable USE_LOCALE which
controls locale stuff. Non-US users now could use ~* operator
for searching and <order by> for strings with nation alphabet.
Please, don't forget, as I did first time, to set environment variable
LC_CTYPE and LC_COLLATE because backend get locale information from them.
I start postmaster from a little script, assuming that shell is Bash shell
it looks like:

#!/bin/sh

export LC_CTYPE=koi8-r
export LC_COLLATE=koi8-r
postmaster -B 1024 -S -D/usr/local/pgsql/data/ -o '-Fe'
This commit is contained in:
Marc G. Fournier 1997-04-02 18:13:47 +00:00
parent a10a951a46
commit 5b1311acfb
9 changed files with 35 additions and 47 deletions

View File

@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.14 1997/03/26 06:53:57 scrappy Exp $
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.15 1997/04/02 18:10:32 scrappy Exp $
#
# NOTES
# Essentially all Postgres make files include this file and use the
@ -146,6 +146,11 @@ ENFORCE_ALIGNMENT= true
# Comment out PROFILE to generate a profile version of the binaries
#PROFILE= -p -non_shared
# Define USE_LOCALE to get Postgres work (sort, search)
# with national alphabet. Remember to define environment variables
# $LC_COLLATE and $LC_CTYPE before starting postmaster !
USE_LOCALE = 1
# If you plan to use Kerberos for authentication...
#
# Comment out KRBVERS if you do not use Kerberos.
@ -716,6 +721,11 @@ ifndef CASSERT
CFLAGS+= -DNO_ASSERT_CHECKING
endif
ifdef USE_LOCALE
CFLAGS+= -DUSE_LOCALE
endif
ifdef PROFILE
CFLAGS+= $(PROFILE)
LDFLAGS+= $(PROFILE)

View File

@ -4,7 +4,7 @@
# Makefile for the bootstrap module
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.4 1996/11/14 07:33:20 bryanh Exp $
# $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.5 1997/04/02 18:10:46 scrappy Exp $
#
#
# We must build bootparse.c and bootscanner.c with yacc and lex and sed,
@ -27,13 +27,6 @@ INCLUDE_OPT= -I.. \
CFLAGS+= $(INCLUDE_OPT)
ifeq ($(CC), gcc)
# Until we figure out how to get rid of the warnings in this directory,
# we must turn off any -Werror that is in CFLAGS now. These options only
# exist for the gcc compiler.
CFLAGS+= -Wno-error
endif
BOOTYACCS= bootstrap_tokens.h bootparse.c
OBJS= bootparse.o bootscanner.o bootstrap.o

View File

@ -7,13 +7,16 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.3 1996/11/14 20:49:09 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.4 1997/04/02 18:11:08 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#ifdef USE_LOCALE
#include <locale.h>
#endif
#include "postgres.h"
#include "miscadmin.h"
#include "bootstrap/bootstrap.h" /* for BootstrapMain() */
@ -31,6 +34,10 @@ int
main(int argc, char *argv[])
{
int len;
#ifdef USE_LOCALE
setlocale(LC_CTYPE,""); /* take locale information from an environment */
setlocale(LC_COLLATE,"");
#endif
#if defined(NOFIXADE) || defined(NOPRINTADE)
/*
* Must be first so that the bootstrap code calls it, too.

View File

@ -5,7 +5,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Id: Makefile,v 1.3 1997/03/14 16:02:40 scrappy Exp $
# $Id: Makefile,v 1.4 1997/04/02 18:11:49 scrappy Exp $
#
#-------------------------------------------------------------------------
@ -16,7 +16,7 @@ INCLUDE_OPT = -I../.. \
-I../../port/$(PORTNAME) \
-I../../../include
CFLAGS+=$(INCLUDE_OPT) -Wno-error
CFLAGS+=$(INCLUDE_OPT)
OBJS = geqo_copy.o geqo_eval.o geqo_main.o geqo_misc.o \
geqo_params.o geqo_paths.o geqo_pool.o geqo_recombination.o \

View File

@ -4,7 +4,7 @@
# Makefile for parser
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.4 1996/11/14 07:33:30 bryanh Exp $
# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.5 1997/04/02 18:12:14 scrappy Exp $
#
#-------------------------------------------------------------------------
@ -17,13 +17,6 @@ INCLUDE_OPT= -I.. \
CFLAGS+= $(INCLUDE_OPT)
ifeq ($(CC), gcc)
# Until we figure out how to get rid of the warnings in this directory,
# we must turn off any -Werror that is in CFLAGS now. These options only
# exist for the gcc compiler.
CFLAGS+= -Wno-error
endif
OBJS= analyze.o catalog_utils.o dbcommands.o gram.o \
keywords.o parser.o parse_query.o scan.o scansup.o sysfunc.o

View File

@ -4,7 +4,7 @@
# Makefile for postmaster
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/postmaster/Makefile,v 1.4 1996/12/28 02:12:04 momjian Exp $
# $Header: /cvsroot/pgsql/src/backend/postmaster/Makefile,v 1.5 1997/04/02 18:12:39 scrappy Exp $
#
#-------------------------------------------------------------------------
@ -17,17 +17,6 @@ INCLUDE_OPT = -I.. \
CFLAGS+=$(INCLUDE_OPT)
ifeq ($(PORTNAME), sparc_solaris)
ifeq ($(CC), gcc)
# Until we figure out how to get rid of the warnings in this directory,
# we must turn off any -Werror that is in CFLAGS now. These options only
# exist for the gcc compiler.
CFLAGS+= -Wno-error
endif
endif
OBJS = postmaster.o
all: SUBSYS.o

View File

@ -4,7 +4,7 @@
# Makefile for tcop
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/tcop/Makefile,v 1.9 1997/03/25 02:35:22 scrappy Exp $
# $Header: /cvsroot/pgsql/src/backend/tcop/Makefile,v 1.10 1997/04/02 18:13:01 scrappy Exp $
#
#-------------------------------------------------------------------------
@ -17,13 +17,6 @@ INCLUDE_OPT= -I.. \
CFLAGS+= $(INCLUDE_OPT)
ifeq ($(CC), gcc)
# Until we figure out how to get rid of the warnings in this directory,
# we must turn off any -Werror that is in CFLAGS now. These options only
# exist for the gcc compiler.
CFLAGS+= -Wno-error
endif
OBJS= aclchk.o dest.o fastpath.o postgres.o pquery.o utility.o variable.o
all: SUBSYS.o

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.11 1997/03/14 23:21:12 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.12 1997/04/02 18:13:24 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@ -311,7 +311,11 @@ text_lt(struct varlena *arg1, struct varlena *arg2)
len--;
}
if (len)
#ifdef USE_LOCALE
return (bool) (strcoll(a2p,a1p));
#else
return (bool) (*a1p < *a2p);
#endif
else
return (bool) (arg1->vl_len < arg2->vl_len);
}
@ -342,7 +346,11 @@ text_le(struct varlena *arg1, struct varlena *arg2)
len--;
}
if (len)
#ifdef USE_LOCALE
return (bool) (strcoll(a2p,a1p));
#else
return (bool) (*a1p < *a2p);
#endif
else
return ((bool) VARSIZE(arg1) <= VARSIZE(arg2));
}

View File

@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile,v 1.11 1997/03/25 09:19:41 scrappy Exp $
# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile,v 1.12 1997/04/02 18:13:47 scrappy Exp $
#
#-------------------------------------------------------------------------
@ -25,11 +25,6 @@ ifdef KRBVERS
CFLAGS+= $(KRBFLAGS)
endif
ifeq ($(CC), gcc)
CFLAGS+= -Wno-error
endif
shlib :=
install-shlib-dep :=