Skip site navigation (1) Skip section navigation (2)

Path-length follies

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Path-length follies
Date: 1999-10-23 04:46:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Whilst cleaning up query-length dependencies, I noticed that our
handling of maximum file pathname lengths is awfully messy.

Different parts of the system rely on no fewer than four different
symbols that they import from several different system header
files (any one of which might not exist on a particular platform):
And on top of that, postgres.h defines MAXPGPATH which is used
by yet other places.

On my system, _POSIX_PATH_MAX = 255, PATH_MAX = 1023, MAXPATHLEN = 1024
(a nearby Linux box is almost but not quite the same) whereas MAXPGPATH
is 128.  So there is absolutely no consistency to the pathname length
limits being imposed in different parts of Postgres.

AFAIK, most or all flavors of Unix have kernel limits on the maximum
length of a pathname that will be accepted by the kernel's file-access
calls (it's 1024 on my box).  So I don't feel any need to remove
hardwired limits on pathname lengths in favor of indefinitely-expansible
buffers.  But it does seem that a little more consistency in the
hardwired limits is called for.

>From the information I have, it seems that the various allegedly-
standard #defines for max pathname length are not too standard,
and I don't think that Postgres internal buffers ought to constrain
path lengths to much less than the kernel limit (so using the
seemingly "standard" _POSIX_PATH_MAX symbol would be a loser).
So my inclination is to define MAXPGPATH as 1024 in config.h, and
remove all uses of the other four symbols in favor of MAXPGPATH.
That would at least provide a single point of tweaking for anyone
who didn't like the value of 1024.

Does anyone have a better idea?  Is it worth trying to extract a
system limit on pathlength during configure, rather than leaving
MAXPGPATH as a manual configuration item --- and if so, exactly how
should configure go about it?

			regards, tom lane


pgsql-hackers by date

Next:From: Charles TassellDate: 1999-10-23 06:29:42
Subject: Re: [GENERAL] Re: What's WAL
Previous:From: Hiroshi InoueDate: 1999-10-23 01:45:49
Subject: RE: [HACKERS] mdnblocks is an amazing time sink in huge relations

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group