Thread: Can the the max identifier lengths be adjusted?

Can the the max identifier lengths be adjusted?

From
oberpwd@anubis.network.com (Wade D. Oberpriller)
Date:
Hello,

Can the internal buffers that PostgreSQL uses for the identifiers be made
larger? I have a few tables with some fields that are already named for me
(i.e. I am mapping some old data that was in a flat-file into a database),
and the names of some of the fields are too long (34 characters) and it appears
that the max identifier length is 31 characters (32 - 1 for the null).

Can this be manually adjusted through some compile-time parameter?


Wade Oberpriller
StorageTek
oberpwd@network.com

Re: Can the the max identifier lengths be adjusted?

From
Tom Lane
Date:
See NAMEDATALEN in src/include/postgres_ext.h.  Note that changing this
requires a full recompile and an initdb.  I'd recommend keeping it a
multiple of 4 to avoid wasting space due to alignment padding.

            regards, tom lane

Re: Can the the max identifier lengths be adjusted?

From
oberpwd@anubis.network.com (Wade D. Oberpriller)
Date:
I've set NAMEDATALEN to 64 and 48, and the compile executed successfully, but
when I perform an initdb, I got the following:

truck{oberpwd}385 > initdb -D /home/anubis22/oberpwd/pgsql/data
This database system will be initialized with username "oberpwd".
This user will own all the data files and must also own the server process.

Creating database system directory /home/anubis22/oberpwd/pgsql/data
Creating database system directory /home/anubis22/oberpwd/pgsql/data/base
Creating database XLOG directory /home/anubis22/oberpwd/pgsql/data/pg_xlog
Creating template database in /home/anubis22/oberpwd/pgsql/data/base/template1
Creating global relations in /home/anubis22/oberpwd/pgsql/data/base
Adding template1 database to pg_database
Segmentation Fault

initdb failed.
Removing /home/anubis22/oberpwd/pgsql/data.
Removing temp file /tmp/initdb.25367.

I re-compiled with NAMEDATALEN set back to 32 and it works fine. It seems that
there is code dependent on this length, and it can't be adjusted simply by
changing this macro.

Any ideas?

Wade Oberpriller
StorageTek
oberpwd@network.com

>
> See NAMEDATALEN in src/include/postgres_ext.h.  Note that changing this
> requires a full recompile and an initdb.  I'd recommend keeping it a
> multiple of 4 to avoid wasting space due to alignment padding.
>
>             regards, tom lane
>


Re: Can the the max identifier lengths be adjusted?

From
Tom Lane
Date:
oberpwd@anubis.network.com (Wade D. Oberpriller) writes:
> I re-compiled with NAMEDATALEN set back to 32 and it works fine. It
> seems that there is code dependent on this length, and it can't be
> adjusted simply by changing this macro.

Yes it can, but not unless you do a full rebuild (top-level "make clean"
then "make all").  The dependencies in the current source tree are
pretty sloppy :-(

            regards, tom lane