Re: Shouldn't non-MULTIBYTE backend refuse to start in MB database? - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: Shouldn't non-MULTIBYTE backend refuse to start in MB database?
Date
Msg-id 20010215104244G.t-ishii@sra.co.jp
Whole thread Raw
In response to Shouldn't non-MULTIBYTE backend refuse to start in MB database?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> We now have defenses against running a non-LOCALE-enabled backend in a
> database that was created in non-C locale.  Shouldn't we likewise
> prevent a non-MULTIBYTE-enabled backend from running in a database with
> a multibyte encoding that's not SQL_ASCII?  Or am I missing a reason why
> that is safe?
> 
> I propose the following addition to ReverifyMyDatabase in postinit.c:
> 
>   #ifdef MULTIBYTE
>       SetDatabaseEncoding(dbform->encoding);
> + #else
> +    if (dbform->encoding != SQL_ASCII)
> +        elog(FATAL, "some suitable error message");
>   #endif
> 
> Comments?

Running a non-MULTIBYTE-enabled backend on a database with a multibyte
encoding other than SQL_ASCII should be safe as long as:

1) read only access
2) the encodings are actually single byte encodings

If mutibyte encoding database is updated by a non-MULTIBYTE-enabled
backend, there might be a chance that data could corrupted since the
backend does not handle mutibyte strings correctly.

So I think you suggestion is a improvement.
--
Tatsuo Ishii


pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Shouldn't non-MULTIBYTE backend refuse to start in MB database?
Next
From: Tom Lane
Date:
Subject: Re: Shouldn't non-MULTIBYTE backend refuse to start in MB database?