Re: Selecting all variations of job title in a list

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Selecting all variations of job title in a list
Date: 2025-11-25 19:29:41
Message-ID: CANzqJaCNFaGTdM9E93_28KMK-AaDSKfP9iq9gbhCNGKh0w8bEA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Nov 25, 2025 at 2:05 PM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:

> On Tue, 25 Nov 2025, Ron Johnson wrote:
>
> > Maybe regex_match() with a bunch of OR clauses.
> >
> > In bash, I'd do something like:
> > grep -E ' ^Asst Gen Mgr.*|^Env Mgr.*|^Gen Mgr.*|^Mgr.*|^Plant Mgr..*'
> > foo.txt
>
> Ron,
>
> I've not used regex in postgres before, only in emacs and small languages.
> So I'll learn how to do this. I was trying to avoid multiple OR clauses,
> but
> that script will not be run often so it should not matter.
>

Failed clarity on my part. The "OR clauses" are within the regex string.

Note that The Relational Way of doing this is for everyone to have
title_code in their "person" record, and the "title" table will have, in
addition to the title_code PK column, the title_description,
title_abbreviation ( 'Asst Gen Mgr.', 'Env Mgr,', 'Gen Mgr,'. 'Mgr,',
'Plant Mgr.') and title_group columns. All those manager titles would be
in the same group. You'd then join "person" to "title" and filter where
title_group="mumble".

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2025-11-25 19:38:17 Re: Selecting all variations of job title in a list
Previous Message Pavel Suderevsky 2025-11-25 19:10:13 Commit LSN after Redo Done At LSN applied during recovery