From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Marko Tiikkaja <marko(at)joh(dot)to> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal: function parse_ident |
Date: | 2015-12-02 20:31:42 |
Message-ID: | CAFj8pRDX_FOE6pgjGTPOEKXfN08pWT4Ps3DaB8sC-vSFL2LnBA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi
2015-11-17 1:49 GMT+01:00 Marko Tiikkaja <marko(at)joh(dot)to>:
> On 9/11/15 12:25 PM, Pavel Stehule wrote:
>
>> new update of parse_ident function patch
>>
>
> Nice! I've certainly wanted something like this a number of times.
>
> Some comments about the v2 of the patch:
>
> - The patch doesn't apply anymore, so it should be rebased.
>
done
> - The docs don't even try and explain what the "strictmode" parameter
> does.
fixed
- The comment before the parse_ident function is not up to date anymore,
> since "the rest" was removed from the interface.
fixed
- I can't immediately grep for any uses of do { .. } while (true) from
> our code base. AFAICT the majority look like for (;;); I see no reason
> not to be consistent here.
>
fixed
- What should happen if the input is a string like
> 'one.two.three.four.five.six'? Do we want to accept input like that?
>
I don't see the reason why not. It is pretty simple to count fields in
result array and raise error later. The application has better information
about expected and valid numbers. But any opinion in this question should
be valid. I have not strong position here.
> - I haven't reviewed the actual parsing code carefully, but didn't we
> already have a function which splits identifiers up? I of course can't
> find one with my grepping right now, so I might be wrong.
>
There is: SplitIdentifierString or textToQualifiedNameList in varlena.c. My
first patch was based on these functions. But I cannot to use it.
1. major reason: The buildin parser is based on searching the dot "." and
doesn't search any disallowed identifiers chars. So there is not possible
to implement non strict mode - find last char of last identifier and ignore
other.
2. minor reason: little bit more precious diagnostics - buildin routines
returns only true (valid) and false (invalid).
Regards
Pavel
>
>
> .m
>
Attachment | Content-Type | Size |
---|---|---|
parse_ident-to-text-array-04.patch | text/x-patch | 9.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2015-12-02 20:37:38 | Re: Another little thing about psql wrapped expanded output |
Previous Message | Julian Schauder | 2015-12-02 20:22:07 | proposal: add 'waiting for replication' to pg_stat_activity.state |