Re: [HACKERS] Path-length follies - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] Path-length follies
Date
Msg-id Pine.LNX.4.20.9911082214050.4161-100000@peter-e.yi.org
Whole thread Raw
In response to Re: [HACKERS] Path-length follies  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Path-length follies
List pgsql-hackers
On 1999-11-06, Tom Lane mentioned:

> Peter Eisentraut <peter_e@gmx.net> writes:
> > Which would lead one to suggest the following as portable as possible way
> > out:
> 
> > #if defined(PATH_MAX)
> >   #define MAXPGPATH PATH_MAX
> > #else
> >   #if defined(MAXPATHLEN)
> >     #define MAXPGPATH MAXPATHLEN
> >   #else
> >     #define MAXPGPATH 255  /* because this is the lowest common
> >                   denominator on Posix systems */
> >   #endif
> > #endif
> 
> I don't think this would be an improvement.  The main problem with it is

That's why I suggested:

#ifndef PATH_MAX
#define PATH_MAX 255
#endif

instead. Then remove all references to MAXPATHLEN and MAXPGPATH. That can
be done rather quickly. The above is standardized and then we'll have a
uniform limit throughout the source, that should be equal to the actual
system limit on 99% of all systems. And it makes the source simpler along
the way. As it is right now, the vast majority of files doesn't use
MAXPGPATH anyway.

Of course, this is a stupid topic to discuss, but please consider the
point.


> However, this line of thought does lead to something that maybe we
> should change: right now, most of the source files are set up as
> 
>     #include <all necessary system header files>
> 
>     #include "postgres.h"
> 
>     #include "necessary postgres headers"
> 
> where config.h is read as part of postgres.h.  I wonder whether it's
> such a good idea to have different source files reading different
> sets of system headers before config.h.  Maybe the standard order
> ought to be
> 
>     #include "postgres.h"
> 
>     #include <all necessary system header files>
> 
>     #include "necessary postgres headers"
> 
> so that config.h is always read in a uniform context.

Definitely.

-- 
Peter Eisentraut                  Sernanders vaeg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] New psql input mode problems
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] New NameStr() macro, RelationGetRelationName fixes