Re: Named Operators - Mailing list pgsql-hackers

From Gurjeet Singh
Subject Re: Named Operators
Date
Msg-id CABwTF4UnQf1L414+8Ls_9Qu4j1H-rzHyg6TzGmx2Omd9HS21pA@mail.gmail.com
Whole thread Raw
In response to Re: Named Operators  (Ted Yu <yuzhihong@gmail.com>)
List pgsql-hackers
On Fri, Jan 20, 2023 at 9:32 AM Ted Yu <yuzhihong@gmail.com> wrote:
>
> Since `validIdentifier` doesn't modify the contents of `name` string, it seems that there is no need to create `tmp`
stringin `validNamedOperator`.
 
> You can pass the start and end offsets into the string (name) as second and third parameters to `validIdentifier`.

Thanks for reviewing the patch!

I was making a temporary copy of the string, since I had to modify it
before the validation, whereas the callee expects a `const char*`. I
agree that the same check can be done with more elegance, while
eliminating the temporary allocation. Please find the updated patch
attached.

Instead of passing the start and end of region I want to check, as
suggested, I'm now passing just the length of the string I want
validated. But I think that's for the better, since it now aligns with
the comment that validIdentifier() does not check if the passed string
is shorter than NAMEDATALEN.

Best regards,
Gurjeet
http://Gurje.et

Attachment

pgsql-hackers by date:

Previous
From: "Takamichi Osumi (Fujitsu)"
Date:
Subject: RE: Time delayed LR (WAS Re: logical replication restrictions)
Next
From: "Takamichi Osumi (Fujitsu)"
Date:
Subject: RE: Time delayed LR (WAS Re: logical replication restrictions)