Skip site navigation (1) Skip section navigation (2)

multi-byte aware char_length() etc.

From: t-ishii(at)sra(dot)co(dot)jp
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: multi-byte aware char_length() etc.
Date: 1998-03-19 04:09:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
I'm planning to modify some string functions so that they would be
aware of multi-byte strings if compiled with the multi-byte
capability.  Followings are files I'm going to modify. I would like to
hear your opinions if you have any.

o character_length()

It seems that the function is implemented as textlen() in
utils/adt/varlena.c or as varcharlen() in varchar.c. Current
implementaion returns an octet length rather than a char length. So I
will change them. However, there might be necessity for getting an
octet length in some applications. Maybe this is a good chance to add
SQL92's octet_length().

o lower()/upper()

Implemented in oracle_compat.c. One thing I have noticed is that it
uses toupper()/tolower(). For ASCII, they are fine. But on some
platforms (I guess SysV) they might have some problems:

	char c;	/* c is an 8-bit letter and this platform uses char as
		   signed char */
	toupper(c);	/* may cause segfault or any other bad thing */

So I will change like:

	toupper((unsigned char)c);

o position()

Implemented as textpos() in varlena.c.

o substring()

Implemented as text_substr() in varlena.c.

Tatsuo Ishii


pgsql-hackers by date

Next:From: The Hermit HackerDate: 1998-03-19 04:10:01
Subject: Re: [HACKERS] First mega-patch...
Previous:From: David GouldDate: 1998-03-19 03:36:05
Subject: Re: [HACKERS] Re: [PATCHES] patches for 6.2.1p6

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group