Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tsrgH-006EKn-Rc for pgsql-general@arkaria.postgresql.org; Thu, 13 Mar 2025 23:09:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tsrgG-008F5I-AI for pgsql-general@arkaria.postgresql.org; Thu, 13 Mar 2025 23:09:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tsrgF-008F59-V2 for pgsql-general@lists.postgresql.org; Thu, 13 Mar 2025 23:09:35 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tsrgE-002h2Z-0C for pgsql-general@lists.postgresql.org; Thu, 13 Mar 2025 23:09:35 +0000 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-3012a0c8496so2428325a91.2 for ; Thu, 13 Mar 2025 16:09:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741907373; x=1742512173; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=NnKcJnOKTlsz1Gqn3xB8o/fryotLmSOvmZb9aqZk9NI=; b=Fm6JiYEdM4jFEpDemPFEAQipY79v1r6SXmMvekAU3la4h9QaUPjXiWX+tBbh9nAJIT 7D8lJvn1w65AtI0D8LvUGJPLpuywxEe02hpy17Db5b9Bzvs8vG3nd3Rn3FN3RHiSLaIE N+13HmJEGpCGWPgf9KN16pWKb5qi7zF7eMzqykJW2Id12tIsKhTbT9uejWslEzwveeAY Z8Wr68v1dF5hSE8kgnT/jEQ9T4A5uy/puNf7512l0xcac+FhN017Zttj25Ob3UQKm6N2 2SZ6lAFl8f7QnX0sCx7ddizmBtbTrfREK5uA9X/7AMpAZvp6XhHqrYJvsuLnlSrZ/HiY Rkng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741907373; x=1742512173; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NnKcJnOKTlsz1Gqn3xB8o/fryotLmSOvmZb9aqZk9NI=; b=UhmMu/sw0TtteVGT8s3FpvExxMj8cDnZLhtY5myoOwgVhZMGoqT3lDHZNoa7n6Eseu X7/6WmDIhz1SnPzsgkYpMPHjt1mzWkrP4wWhpz1ji2TPvOqyRaG3DKfPuPjkkDHXYcIb xQ/SGXR4nnUjjmdQ8Vuuoh6wTeI3Gc/LqBsSO4lnmLedkF5Xq8U/jOvkfInDiwBgMwLD wLYWOaJpnS4zkPutgqKx4W8ZDw5BrjGj+2pFthMs+BReFYb9py/U9U0MeeLOIS+jSj2A vMMlralBp8fvBp7rRcabi+GrvQMRbt4IlnBdQvwfziE4Xto8EhR74sI+7KvQyxyPl4ZX cBoQ== X-Gm-Message-State: AOJu0Yz5fSKjgN09RHlWciGIyw4whcf5fjM8rBaFq079mQMk2jq25skN LUx4nM5r10ooCd54OZA71W3AkuF8OJOWxLkdwkGav3cCZv/+eIDpE60Q2MRcISSe5d6glF/s5Zb lUyH0VvVy5R3wE8bpf1hl/O4fs0lN3uq+ X-Gm-Gg: ASbGnct4Y8bHU3LPRHBQb1YHaQl8rqneQo8ZfvOmwF/YGbwgnN9iy7n169jrUu98WoH 0/CcfkI4GwrNNt1lPADja1rux7bJi6YwB09ri5obpgUP9XFP6iYjg9ykRCeews2XGhzTT1GOkgT 2zGY2nIaVRMrWVzC8hB3U+sDETOSVQSHT83k0PbedLnDw5ih2+GGqtyNtA X-Google-Smtp-Source: AGHT+IEGNdKCK4U0vR8YAwyobw/52+POr/M0a5EmBRLHdYtstJv/pbjUk1NsRAO2AV+tmDoeZtkTei3rGbqB+84dcNE= X-Received: by 2002:a17:90b:3bce:b0:2ff:64c3:3bd9 with SMTP id 98e67ed59e1d1-30151daa3dbmr329567a91.23.1741907372695; Thu, 13 Mar 2025 16:09:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Hans Schou Date: Fri, 14 Mar 2025 00:09:16 +0100 X-Gm-Features: AQ5f1Jr9jRz4QI6vxc23UMrwndynU4qTUf5bFSoIYibJOXr2DxC_CAcOUAYhcis Message-ID: Subject: Re: psql and regex not like To: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000002e68770630416adf" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000002e68770630416adf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Mar 6, 2025 at 10:38=E2=80=AFAM Ron Johnson 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 ' !'" --0000000000002e68770630416adf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Mar 6, 2025 at 10:38=E2=80=AFAM Ron J= ohnson <ronljohnsonjr@gmail.c= om> wrote:
psql -Xc "select datn= ame from pg_database WHERE datname \!~ 'template|postgres' ORDER BY= datname;"

Remo= ve the space:

psql -Xc "select datname from p= g_database WHERE datname!~ 'template|postgres' ORDER BY datname&quo= t;

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

--0000000000002e68770630416adf--