Re: update substring pattern matching syntax

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: update substring pattern matching syntax
Date: 2020-06-20 07:08:06
Message-ID: alpine.DEB.2.22.394.2006200835570.859381@pseudo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Peter,

> whereas the current standard says
>
> SUBSTRING(text SIMILAR pattern ESCAPE escapechar)
>
> The former was in SQL99, but the latter has been there since SQL:2003.
>
> It's pretty easy to implement the second form also, so here is a patch that
> does that.

Patches apply cleanly, compile and "make check" is ok. doc gen is ok as
well.

Grammar cleanup is a definite improvement as it makes the grammar closer
to the actual syntax.

I cannot say I'm a fan of this kind of keywords added for some arguments.
I guess that it allows distinguishing between variants. I do not have the
standard at hand: I wanted to check whether these keywords could be
reordered, i.e. whether SUBSTRING(text ESCAPE ec SIMILAR part) was legal.
I guess not.

Maybe the doc could advertise more systematically whether a features
conforms fully or partially to some SQL standards, or is pg specific. The
added documentation refers both to SQL:1999 and SQL99. I'd suggest to
chose one, possibly the former, and use it everywhere consistently.

It seems that two instances where not updated to the new syntax, see in
./src/backend/catalog/information_schema.sql and
./contrib/citext/sql/citext.sql.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2020-06-20 10:16:52 Re: Failures with wal_consistency_checking and 13~
Previous Message Michael Paquier 2020-06-20 06:53:54 Re: min_safe_lsn column in pg_replication_slots view