Re: pg_upgrade code questions - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: pg_upgrade code questions
Date
Msg-id 201005140013.o4E0DpF13571@momjian.us
Whole thread Raw
In response to pg_upgrade code questions  (Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: pg_upgrade code questions
List pgsql-hackers
Takahiro Itagaki wrote:
> I read pg_upgrade code glance over, and found 4 issues in it.
> Are there any issues to be fixed before 9.0 release?
> 
>     1. NAMEDATASIZE
>     2. extern PGDLLIMPORT
>     3. pathSeparator
>     4. EDB_NATIVE_LANG
> 
> ==== 1. NAMEDATASIZE ====
> pg_upgrade has the following definition, but should it be just NAMEDATALEN?
> 
>     /* Allocate for null byte */
>     #define NAMEDATASIZE        (NAMEDATALEN + 1)
> 
> Table names should be in NAMEDATELEN - 1 bytes. At least 64th bytes in 
> "name" data is always '\0'.
> 
>     =# CREATE TABLE "1234567890...(total 70 chars)...1234567890" (i int);
>     NOTICE:  identifier "123...890" will be truncated to "123...0123"

Agreed.  I have changed the code to use NAMEDATALEN.

> ==== 2. extern PGDLLIMPORT ====
> pg_upgrade has own definitions of
>     extern PGDLLIMPORT Oid binary_upgrade_next_xxx
> in pg_upgrade_sysoids.c. But those variables are not declared as
> PGDLLIMPORT in the core. Can we access unexported variables here?

The issue here is that you use PGDLLIMPORT where you are importing the
variable, not where it is defined.  For example, look at
'seq_page_cost'.  You can see PGDLLIMPORT used where it is imported with
'extern', but not where is it defined.

> ==== 3. pathSeparator ====
> Path separator for Windows is not only \ but also /. The current code
> ignores /. Also, it might not work if the path string including multi-byte
> characters that have \ (0x5c) in the second byte.

Agreed.  I have modified the code to use only "/" and check for "/" and
"\".  It is used only for checking the last byte so I didn't think it
would affect a multi-byte sequence.  I am actually unclear on that issue
though.  Can you review the new code to see if it is OK.

> ==== 4. EDB_NATIVE_LANG ====
> Of course it is commented out with #ifdef, but do we have codes
> for EDB in core?

Yeah, removed.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com


pgsql-hackers by date:

Previous
From: Florian Pflug
Date:
Subject: Re: Row-level Locks & SERIALIZABLE transactions, postgres vs. Oracle
Next
From: "Joshua D. Drake"
Date:
Subject: Re: pg_upgrade code questions