Re: psql and regex not like

2025-03-13 Thread Hans Schou
On Thu, Mar 6, 2025 at 10:38 AM 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

Re: psql and regex not like

2025-03-13 Thread Renan Alves Fonseca
Another dirty hack: MAGIC=\! psql -Xc "select datname from pg_database WHERE datname $MAGIC~ 'template|postgres' ORDER BY datname;" Em qui., 6 de mar. de 2025 às 10:38, Ron Johnson escreveu: > This statement runs great from the psql prompt. Does exactly what I want. > select datname from pg_da

Re: psql and regex not like

2025-03-09 Thread Ron Johnson
On Thu, Mar 6, 2025 at 6:11 AM hubert depesz lubaczewski wrote: > On Thu, Mar 06, 2025 at 04:37:56AM -0500, Ron Johnson wrote: > > This statement runs great from the psql prompt. Does exactly what I > want. > > select datname from pg_database WHERE datname !~ 'template|postgres' > ORDER > > BY d

Re: psql and regex not like

2025-03-09 Thread Dominique Devienne
On Thu, Mar 6, 2025 at 11:24 AM Ron Johnson 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

psql and regex not like

2025-03-07 Thread Ron Johnson
This statement runs great from the psql prompt. Does exactly what I want. select datname from pg_database WHERE datname !~ 'template|postgres' ORDER BY datname; But it doesn't work so well from the bash prompt. Not escaping the "!" generates a bunch of garbage, while escaping throws an sql synta

Re: psql and regex not like

2025-03-06 Thread hubert depesz lubaczewski
On Thu, Mar 06, 2025 at 04:37:56AM -0500, Ron Johnson wrote: > This statement runs great from the psql prompt. Does exactly what I want. > select datname from pg_database WHERE datname !~ 'template|postgres' ORDER > BY datname; > But it doesn't work so well from the bash prompt. Not escaping the

Re: psql and regex not like

2025-03-06 Thread François Lafont
Hi, On 3/6/25 10:37, Ron Johnson wrote: This statement runs great from the psql prompt.  Does exactly what I want. select datname from pg_database WHERE datname !~ 'template|postgres' ORDER BY datname; But it doesn't work so well from the bash prompt.  Not escaping the "!" generates a bunch o

Re: psql and regex not like

2025-03-06 Thread Ron Johnson
On Thu, Mar 6, 2025 at 4:59 AM Dominique Devienne wrote: > On Thu, Mar 6, 2025 at 10:38 AM Ron Johnson > wrote: > > This statement runs great from the psql prompt. Does exactly what I > want. > > select datname from pg_database WHERE datname !~ 'template|postgres' > ORDER BY datname; > > > > Bu

Re: psql and regex not like

2025-03-06 Thread Dominique Devienne
On Thu, Mar 6, 2025 at 10:38 AM Ron Johnson wrote: > This statement runs great from the psql prompt. Does exactly what I want. > select datname from pg_database WHERE datname !~ 'template|postgres' ORDER BY > datname; > > But it doesn't work so well from the bash prompt. Not escaping the "!" >