From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Tighten up a few overly lax regexes in pg_dump's tap tests |
Date: | 2019-02-05 10:09:42 |
Message-ID: | 7260BBB4-0E01-4D64-A31D-A8456B40CF12@yesql.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On 5 Feb 2019, at 06:55, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Monday, February 4, 2019, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com <mailto:david(dot)rowley(at)2ndquadrant(dot)com>> wrote:
> On Tue, 5 Feb 2019 at 01:12, Daniel Gustafsson <daniel(at)yesql(dot)se <mailto:daniel(at)yesql(dot)se>> wrote:
> > We may also want to use the + metacharacter instead of * in a few places, since
> > the intent is to always match something, where matching nothing should be
> > considered an error:
> >
> > - qr/^ALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO .*;/m,
> > + qr/^ALTER TEXT SEARCH DICTIONARY dump_test\.alt_ts_dict1 OWNER TO .*;/m,
>
> I looked for instances of * alone and didn't see any. I only saw ones
> prefixed with ".", in which case, isn't that matching 1 or more chars
> already?
>
> No. In Regex the following are equivalent:
>
> .* == .{0,}
> .+ == .{1,}
> . == .{1}
>
> A “*” by itself would either be an error or, assuming the preceding character is a space (so it visually looks alone) would be zero or more consecutive spaces.
Sorry for being a bit unclear in my original email, it’s as David says above:
.* matches zero or more characters and .+ matches 1 or more characters.
> In the above “...OWNER TO<space>;” is a valid match.
Indeed, so we should move to matching with .+ to force an owner.
cheers ./daniel
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2019-02-05 10:30:48 | Re: Online verification of checksums |
Previous Message | John Naylor | 2019-02-05 09:55:28 | Re: WIP: Avoid creation of the free space map for small tables |