public inbox for [email protected]  
help / color / mirror / Atom feed
From: Dominique Devienne <[email protected]>
To: Ron Johnson <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: psql and regex not like
Date: Thu, 6 Mar 2025 11:41:42 +0100
Message-ID: <CAFCRh-8TmYG4Ya_VLsRy2ybZSfYfuOzZ_i0+EGxSkrbja1JZWg@mail.gmail.com> (raw)
In-Reply-To: <CANzqJaBaottzqJm6MjP_tuATRs81vtBanjn1Ba0sY==7FoUjXw@mail.gmail.com>
References: <CANzqJaCmmqNjSNitxWPekwM7mQesZCfAdXjOprKao8Ted35E-w@mail.gmail.com>
	<CAFCRh-8QB7PQS_ny7GEgxBU_VLkAuj-Wwk_vtsM5bivWc-HbXg@mail.gmail.com>
	<CANzqJaBaottzqJm6MjP_tuATRs81vtBanjn1Ba0sY==7FoUjXw@mail.gmail.com>

On Thu, Mar 6, 2025 at 11:24 AM Ron Johnson <[email protected]> wrote:
> I already do that.  This is part of a long chain of commands so I'm trying to minimize the length of commands.

but given that your regexp patterns are not anchored, they are not
equivalent. I think mine is "more correct".

> Anyway, it would be good to know the answer for any future queries that need multiple exclusions.

Sure. First, it works fine with TCSH :). I repro a (different) failure
in BASH. But the below works fine for me:

psql "service=acme" -Xc 'select datname from pg_database where datname
!~ $$(template|postgres)$$ order by 1'

i.e. use single-quotes, and an inner $$ literal. One of 3 options an
AI chatbot gave me. --DD






view thread (3+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: psql and regex not like
  In-Reply-To: <CAFCRh-8TmYG4Ya_VLsRy2ybZSfYfuOzZ_i0+EGxSkrbja1JZWg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox