| From: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
|---|---|
| To: | li(dot)evan(dot)chao(at)gmail(dot)com, vik(at)postgresfriends(dot)org, david(dot)g(dot)johnston(at)gmail(dot)com, jacob(dot)champion(at)enterprisedb(dot)com, er(at)xs4all(dot)nl, peter(at)eisentraut(dot)org |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Row pattern recognition |
| Date: | 2025-12-01 12:42:18 |
| Message-ID: | 20251201.214218.2122261000526503186.ishii@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
>> I just finished reviewing 0007 and 0008. This patch set really demonstrates the full lifecycle of adding a SQL feature, from changing the syntax in gram.y all the way down to the executor, including tests and docs. I learned a lot from it. Thanks!
>
> You are welcome!
>
>> 23 - 0007
>>
>> As you mentioned earlier, pattern regular expression support *, + and ?, but I don’t see ? is tested.
>
> Good catch. I will add the test case. In the mean time I found a bug
> with gram.y part which handles '?' quantifier. gram.y can be
> successfully compiled but there's no way to put '?' quantifier in a
> SQL statement. We cannot write directly "ColId '?'" like other
> quantifier '*' and '+' in the grammer because '?' is not a "self"
> token. So we let '?' matches Op first then check if it's '?' or
> not.
>
> | ColId Op
> {
> if (strcmp("?", $2))
> ereport(ERROR,
> errcode(ERRCODE_SYNTAX_ERROR),
> errmsg("unsupported quantifier"),
> parser_errposition(@2));
>
> $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "?", (Node *)makeString($1), NULL, @1);
> }
>
> Another bug was with executor (nodeWindowAgg.c). The code to check
> greedy quantifiers missed the case '?'.
>
>> 24 - 0007
>>
>> I don’t see negative tests for unsupported quantifiers, like PATTERN (A+?).
>
> I will add such test cases.
>
>> 25 - 0007
>> ```
>> +-- basic test with none greedy pattern
>> ```
>>
>> Typo: “none greedy” -> non-greedy
>
> Will fix.
>
>> No comment for 0008.
>
> Thanks again for the review. I will post v35 patch set soon. Attached
> is the diff from v34.
Attached are the v35 patches for Row pattern recognition. Chao Li
reviewed v34 thoroughly. Thank you! v35 reflects the review
comments. Major differences from v34 include:
- Make "DEFINE" an unreserved keyword. Previously it was a reserved keyword.
- Refactor transformDefineClause() to make two foreach loops into single foreach loop.
- Make '?' quantifier in PATTERN work as advertised. Test for '?' quantifier is added too.
- Unsupported quantifier test added.
- Fix get_rule_define().
- Fix memory leak related to regcomp.
- Move regcomp compiled result cache from static data to WindowAggState.
- Fix several typos.
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
| Attachment | Content-Type | Size |
|---|---|---|
| v35-0001-Row-pattern-recognition-patch-for-raw-parser.patch | application/octet-stream | 15.6 KB |
| v35-0002-Row-pattern-recognition-patch-parse-analysis.patch | application/octet-stream | 10.8 KB |
| v35-0003-Row-pattern-recognition-patch-rewriter.patch | application/octet-stream | 4.1 KB |
| v35-0004-Row-pattern-recognition-patch-planner.patch | application/octet-stream | 6.5 KB |
| v35-0005-Row-pattern-recognition-patch-executor.patch | application/octet-stream | 60.9 KB |
| v35-0006-Row-pattern-recognition-patch-docs.patch | application/octet-stream | 11.1 KB |
| v35-0007-Row-pattern-recognition-patch-tests.patch | application/octet-stream | 58.2 KB |
| v35-0008-Row-pattern-recognition-patch-typedefs.list.patch | application/octet-stream | 1.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Aleksander Alekseev | 2025-12-01 12:44:55 | Re: Migrate to autoconf 2.72? |
| Previous Message | Heikki Linnakangas | 2025-12-01 12:40:01 | Re: IPC/MultixactCreation on the Standby server |