Re: psql patch

Поиск
Список
Период
Сортировка
Искать
От
Jeroen T. Vermeulen
Тема
Re: psql patch
Дата
Msg-id
20030320223904.GH28190@xs4all.nl
Ответ на
Re: psql patch (Bruce Momjian)
Список
Дерево обсуждения
Re: psql patch Bruce Momjian <pgman@candle.pha.pa.us>
Re: psql patch "Jeroen T. Vermeulen" <jtv@xs4all.nl>
Re: psql patch Bruce Momjian <pgman@candle.pha.pa.us>
Re: psql patch "Jeroen T. Vermeulen" <jtv@xs4all.nl>
On Thu, Mar 20, 2003 at 05:13:05PM -0500, Bruce Momjian wrote:
> 
> I have applied the following patch to fix a bug in the new psql patch. 
> It wasn't handling multi-line /* */ comments properly.  Jeroen, would
> you review the change.  The rest of the changes look very good.
 
Yes, come to think of it I can see now that it also wouldn't deal
with special sequences like '--' or unmatched quotes and parentheses
very well either.  Nor did the original version, from the looks of
it, so I'd like to suggest moving the whole "if (in_xcomment)" clause
up a little in the else-if chain, to just below the "if (in_quote)"
one.  That would make the thing ignore all special sequences except
'*/' when inside an xcomment, and all sequences inside a quote
(except a closing quote, of course).  Plus, just in case any
legitimate expression could give rise to the sequence "*/" ouside
of an xcomment, that would also be handled properly.

BTW your version could be simplified a little:

	/* [ "if (in_quote)" clause here ] */

	/* end of extended comment? */
	else if (in_xcomment)
	{
		if ((line[i] == '*') && 
		    (line[i + thislen] == '/') &&
		    !--in_xcomment)
			ADVANCE_1;
	}

	/* start of extended comment? */
	/* [ '/*' clause here ] */


Lessee...  I hope this says it all, but if you like I can submit
a patch to today's CVS version.


Jeroen

В списке pgsql-patches по дате отправления
От: Bruce Momjian
Дата:
От: Jeroen T. Vermeulen
Дата:
Сообщение: Re: psql patch
FAQ