Re: [HACKERS] create database doesn't work well in MULTIBYTE mode

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] create database doesn't work well in MULTIBYTE mode
Date: 2000-02-18 04:49:29
Message-ID: 38ACCF59.875C0222@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > At the moment, if the code is compiled without MULTIBYTE enabled, it
> > will silently ignore any "ENCODING=" clause in a CREATE DATABASE
> > statement.
> template1=# create database foo with encoding='LATIN1';
> ERROR: Multi-byte support is not enabled
> I believe that you have missed that a fair amount of work is being done in
> the create_opt_encoding rule. Take a look.

Ah, thanks. I was misled (why try actually testing it? I was reading
the source ;) by some crufty code above createdb_opt_encoding (some
tabs removed for readability):

...
#ifdef MULTIBYTE
n->encoding = $6;
#else
n->encoding = 0;
#endif
...

where in fact if MULTIBYTE is not enabled and $6 is non-empty, the $6
production never returns! I'm planning on fixing this up (yacc
willing) to *not* do anything special when MULTIBYTE is on or off, but
will instead embed all of this funny business down in
createdb_opt_encoding with the other stuff already there.

So, why does the createdb_opt_encoding ($6 above) bother trying to
return "-1" when MULTIBYTE is disabled, when that -1 is ignored and
replaced with a zero anyway? Is it acceptable to return -1, as the $6
production does, or should it really be returning the zero which is
passed along??

- Thomas

--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-02-18 04:52:39 Re: [HACKERS] Date/time types: big changeu
Previous Message Alfred Perlstein 2000-02-18 02:21:28 Re: [HACKERS] psql and Control-C