Re: using regular expression queries with regular expression indexes - Mailing list pgsql-admin

From Thomas Kellerer
Subject Re: using regular expression queries with regular expression indexes
Date
Msg-id fe5ba8cb-4d5a-8ed5-cda2-6cad27a9bf0c@gmx.net
Whole thread Raw
In response to using regular expression queries with regular expression indexes  (Mark Steben <mark.steben@drivedominion.com>)
List pgsql-admin
Mark Steben schrieb am 25.06.2020 um 18:45:
> I have a query that uses regexp code to confirm if a text field is a date or not.

Why don't you define it as a date column? (e.g. so that leap years are corretly dealt with)

But if you can't do that, what about a generated column that uses that regex to populate a boolean flag, e.g.
is_valid_date?

Then the expensive regex evaluation would only be done when you change the value, not everytime you query it.

Thomas



pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: using regular expression queries with regular expression indexes
Next
From: Mai Peng
Date:
Subject: After renaming a database the subscription ( logical replication)stay sticky to the old database (master)