Re: Tighten up a few overly lax regexes in pg_dump's tap tests

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Tighten up a few overly lax regexes in pg_dump's tap tests
Дата
Msg-id 20190206113756.GD14980@paquier.xyz
обсуждение исходный текст
Ответ на Re: Tighten up a few overly lax regexes in pg_dump's tap tests  (Daniel Gustafsson <daniel@yesql.se>)
Ответы Re: Tighten up a few overly lax regexes in pg_dump's tap tests  (Daniel Gustafsson <daniel@yesql.se>)
Список pgsql-hackers
On Wed, Feb 06, 2019 at 10:50:27AM +0100, Daniel Gustafsson wrote:
> I still think we should enforce one-or-more matching on the OWNER part as well,
> since matching zero would be a syntax error.  There are more .* matches but
> I’ve only touched the ones which match SQL, since there is a defined grammar to
> rely on there.  The attached patch does that on top of your commit.

-       regexp => qr/^COMMENT ON DATABASE postgres IS .*;/m,
+       regexp => qr/^COMMENT ON DATABASE postgres IS .+;/m,
So...  With what's on HEAD the current regex means that all these are
correct commands:
COMMENT ON DATABASE postgres is ;
COMMENT ON DATABASE postgres is  foo;
COMMENT ON DATABASE postgres is foo;
And for the first one that's obviously wrong.

So what you are suggesting is to actually make the first pattern
something to complain about, right?  And ".+" this makes sure that at
least one character is present, while for ".*" it is fine to have zero
characters.  What you are suggesting looks right if I understood that
right.
--
Michael

Вложения

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

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Tighten up a few overly lax regexes in pg_dump's tap tests
Следующее
От: Andres Freund
Дата:
Сообщение: Re: fast defaults in heap_getattr vs heap_deform_tuple