pg_hba.conf additional comment re local line

Started by Andrew Dunstanalmost 22 years ago7 messagespatches
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

The attached tiny patch will possibly help to avoid some confusion by
Windows users about the "local" line in pg_hba.conf (and thus help
reduce queries to us ;-) ). It also removes an essentially content-free
suffix in 2 nearby comment lines.

cheers

andrew

Attachments:

hba.patchtext/x-patch; name=hba.patchDownload+5-4
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Andrew Dunstan (#1)
Re: pg_hba.conf additional comment re local line

Andrew Dunstan wrote:

The attached tiny patch will possibly help to avoid some confusion by
Windows users about the "local" line in pg_hba.conf (and thus help
reduce queries to us ;-) ). It also removes an essentially
content-free suffix in 2 nearby comment lines.

Maybe initdb should just remove those lines on Windows.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Peter Eisentraut (#2)
Re: pg_hba.conf additional comment re local line

Peter Eisentraut wrote:

Andrew Dunstan wrote:

The attached tiny patch will possibly help to avoid some confusion by
Windows users about the "local" line in pg_hba.conf (and thus help
reduce queries to us ;-) ). It also removes an essentially
content-free suffix in 2 nearby comment lines.

Maybe initdb should just remove those lines on Windows.

You are probably right. initdb's filtering capabilities are (by design)
rather primitive - I didn't want to clutter it up with regex code - so
it's a bit less easy than it might otherwise be.

This patch was done as a "quick fix".

If someone doesn't beat me to it I will try to look at initdb in the
next week or so.

cheers

andrew

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: pg_hba.conf additional comment re local line

Andrew Dunstan <andrew@dunslane.net> writes:

The attached tiny patch will possibly help to avoid some confusion by
Windows users about the "local" line in pg_hba.conf (and thus help
reduce queries to us ;-) ).

I was wondering if we could teach initdb to remove that line altogether
in Windows installations.

regards, tom lane

#5Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#4)
Re: pg_hba.conf additional comment re local line

Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.net> writes:

The attached tiny patch will possibly help to avoid some confusion by
Windows users about the "local" line in pg_hba.conf (and thus help
reduce queries to us ;-) ).

I was wondering if we could teach initdb to remove that line altogether
in Windows installations.

See later email.

Of course it can be done. Probably the simplest way is a new small
routine called, say filter_token, which would remove lines containing a
given token:

static char **filter_token(char **lines, char *token);

Then we could have something like:

#ifdef WIN32 (orwhatever we are calling it now)
conflines = filter_token(conflines,"@remove-line-for-win32@");
#else
conflines = replace_token(conflines, "@remove-line-for-win32@","");
#endif

Incidentally, even Unix users frequently get confused about the "local"
line - one of the commonest newbie mistakes is to think it means
localhost. So marking it clearly as being for Unix domain sockets would
still be a Good Thing (tm).

cheers

andrew

Show quoted text

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

#6Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#5)
Re: pg_hba.conf additional comment re local line

The original of this seems to have gotten lost in the ether somewhere.
It might turn up some day ...

andrew

Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.net> writes:

The attached tiny patch will possibly help to avoid some confusion by
Windows users about the "local" line in pg_hba.conf (and thus help
reduce queries to us ;-) ).

I was wondering if we could teach initdb to remove that line altogether
in Windows installations.

I think this does what Tom and Peter suggested. I don't have a Windows
box to test it on, though.

cheers

andrew

Attachments:

hba.patchtext/x-patch; name=hba.patchDownload+45-7
#7Bruce Momjian
bruce@momjian.us
In reply to: Andrew Dunstan (#6)
Re: pg_hba.conf additional comment re local line

Patch applied. Thanks.

I adjusted the code slightly and I tested !HAVE_UNIX_SOCKETS rather than
Win32.

---------------------------------------------------------------------------

Andrew Dunstan wrote:

The original of this seems to have gotten lost in the ether somewhere.
It might turn up some day ...

andrew

Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.net> writes:

The attached tiny patch will possibly help to avoid some confusion by
Windows users about the "local" line in pg_hba.conf (and thus help
reduce queries to us ;-) ).

I was wondering if we could teach initdb to remove that line altogether
in Windows installations.

I think this does what Tom and Peter suggested. I don't have a Windows
box to test it on, though.

cheers

andrew

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073