Re: Parsing config files in a directory

Поиск
Список
Период
Сортировка
От Greg Smith
Тема Re: Parsing config files in a directory
Дата
Msg-id alpine.GSO.2.01.0910281304200.12952@westnet.com
обсуждение исходный текст
Ответ на Re: Parsing config files in a directory  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Parsing config files in a directory  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Wed, 28 Oct 2009, Tom Lane wrote:

> Why in the world are you looking at initdb?  The standard reference for 
> postgresql.conf-reading code, by definition, is guc-file.l.  I think the 
> odds of building something that works right, without borrowing that same 
> flex logic, are about nil.

initdb was the only sample around that actually makes changes to the 
postgresql.conf.  It's also a nice simple standalone program that's easy 
to borrow pieces from, which guc-file.l is not.  That's the reason it 
looks tempting at first.

If as you say the only right way to do this is to use the flex logic, that 
just reinforced how high the bar is for someone who wants to write a tool 
that modifies the file.  Periodically we get people who show up saying 
"hey, I'd like to write a little [web|cli|gui] tool to help people update 
their postgresql.conf file", and when the answer they get incudes "first 
you need to implement this grammar..." that's scares off almost all of 
them.  It didn't work on me because I used to write compilers for fun 
before flex existed.  But even I just skimmed it and pragmatically wrote a 
simpler postgresql.conf parser implementation that worked well enough to 
get a working prototype out the door, rather than properly the whole 
grammar.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: Parsing config files in a directory
Следующее
От: Greg Smith
Дата:
Сообщение: Re: Parsing config files in a directory