Patching for increasing the number of columns - Mailing list pgsql-hackers

From Mayeul Kauffmann
Subject Patching for increasing the number of columns
Date
Msg-id 53F4C11C.5030809@free.fr
Whole thread Raw
Responses Re: Patching for increasing the number of columns
List pgsql-hackers
Hello,

I am trying to patch the server source to increase the number of columns 
above 1600. I'm not planning to commit this but as suggested elsewhere 
[1], someone might suggest a configure option based on this.
I came up with a patch which seems to work (see below), but 3 of the 136 
tests fail.

I understand some will question db design, but, as written elsewhere, 
"What would be most helpful though is if the answer to this question 
stop being an attack on the business requirement analysis, database 
design skills, and/or sanity of the requester" [1]

I based my attempts on these discussions:
http://www.postgresql.org/message-id/200512221633.jBMGXWM13248@candle.pha.pa.us
http://www.postgresql.org/message-id/8914.1289620175@sss.pgh.pa.us

http://dba.stackexchange.com/questions/40137/in-postgresql-is-it-possible-to-change-the-maximum-number-of-columns-a-table-ca

I build this on Ubuntu 14.04, 64 bits. Bash session follows:

======================================================
sudo apt-get install flex
sudo apt-get install bison build-essential
sudo apt-get install libreadline6-dev
sudo apt-get install zlib1g-dev
sudo apt-get install libossp-uuid-dev

version=3_64  # change this if you want to build several versions of 
postgres in parallel
# see also "MODIFY THIS TOO" below

echo "current version is"  $version
mkdir -p ~/bin/postgresql_9.3.4
cd ~/bin/postgresql_9.3.4
wget ftp://ftp.postgresql.org/pub/source/v9.3.4/postgresql-9.3.4.tar.bz2
mkdir -p ~/bin/postgresql_9.3.4/patched_$version
tar -xvf postgresql-9.3.*.tar.bz2 -C ~/bin/postgresql_9.3.4/patched_$version
cd patched_$version/postgresql-9.3.*

# use kate (KDE) or your preferred text editor:
kate src/include/access/htup_details.h

# See: 

http://dba.stackexchange.com/questions/40137/in-postgresql-is-it-possible-to-change-the-maximum-number-of-columns-a-table-ca
# Replace this:
#define MaxTupleAttributeNumber 1664    /* 8 * 208 */
# by this: (the '#' sign  'define' should be included)
#define MaxTupleAttributeNumber 6656    /* 32 * 208 */
# or this:
#define MaxTupleAttributeNumber 13312    /* 64 * 208 */

# Replace this:
#define MaxHeapAttributeNumber    1600    /* 8 * 200 */
# by this: (the '#' sign before 'define' should be included)
#define MaxHeapAttributeNumber    6400    /* 32 * 200 */
# or this:
#define MaxHeapAttributeNumber    12800    /* 64 * 200 */


# See: 
http://www.postgresql.org/message-id/8914.1289620175@sss.pgh.pa.us 
suggests this:  uint16    t_hoff;
# Replace this:  (in TWO PLACES)  (near lines 148 and lines 523. If you 
miss one, postgresql segfaults.)  uint8 t_hoff; /* sizeof header incl. bitmap, padding */
# by this:     (in TWO PLACES)  uint32 t_hoff; /* sizeof header incl. bitmap, padding */
# or by this:    (in TWO PLACES)    uint64 t_hoff; /* sizeof header incl. bitmap, padding */

# Save and close htup_details.h
# (TODO: write the above as a command-line patch)

./configure --with-blocksize=32 --prefix=/usr/local/pgsql_patched_$version

make
make check

# join                     ... FAILED
# select_views             ... FAILED
# without_oid              ... FAILED
# ========================
#  3 of 136 tests failed.     FIXME
# ========================
(not sure whether I can attach the log and diff of the test here).

I launched the server anyway and logged in with pgadmin3. I created a 
few tables with 2000 integer fields or so. Performed a few insert, 
select, update and join without any issue.
So at least basic join works. And in pgadmin3, the "has OIDs" porperties 
of tables I created is not checked.

Just to be sure, I performed again all the tests with 'make check' 
without any patch and without raising the blocksize  (configure option), 
and this time all the tests passed (NO failure).

Would anyone have some hint or advice?
Thank you!
Best regards,
Mayeul


[1] http://www.postgresql.org/message-id/8914.1289620175@sss.pgh.pa.us

PS: and since it's my first post here: thank you all so much for this 
wonderful DBMS :-)



pgsql-hackers by date:

Previous
From: Thom Brown
Date:
Subject: Re: [GSoC2014] Patch ALTER TABLE ... SET LOGGED
Next
From: David Fetter
Date:
Subject: Re: Patch status: delta relations in AFTER triggers