Re: using regular expression queries with regular expression indexes

From: Thomas Kellerer <shammat(at)gmx(dot)net>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: using regular expression queries with regular expression indexes
Date: 2020-06-25 18:17:47
Message-ID: fe5ba8cb-4d5a-8ed5-cda2-6cad27a9bf0c@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Mai Peng 2020-06-29 12:58:32 After renaming a database the subscription ( logical replication) stay sticky to the old database (master)
Previous Message Tom Lane 2020-06-25 16:57:49 Re: using regular expression queries with regular expression indexes