Re: psql and regex not like

Hans Schou <hans.schou@gmail.com>

From: Hans Schou <hans.schou@gmail.com>
To: pgsql-general@lists.postgresql.org
Date: 2025-03-13T23:09:16Z
Lists: pgsql-general
On Thu, Mar 6, 2025 at 10:38 AM Ron Johnson <ronljohnsonjr@gmail.com> wrote:

> psql -Xc "select datname from pg_database WHERE datname \!~
> 'template|postgres' ORDER BY datname;"
>

Remove the space:

psql -Xc "select datname from pg_database WHERE datname!~
'template|postgres' ORDER BY datname"

I'm not really sure why as this one works:
psql -c "SELECT ' !'"