Re: escape string syntax and pg_dumpall

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: andrew(at)supernews(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: escape string syntax and pg_dumpall
Date: 2005-07-18 19:01:31
Message-ID: 15930.1121713291@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew - Supernews <andrew+nonews(at)supernews(dot)com> writes:
>>> "WHERE spcname NOT LIKE E'pg\\_%'");

> It's not even correct as it stands - if you want to match a literal _
> using LIKE then you would need E'pg\\\\_%' there.

Good point!

> Would NOT LIKE 'pg!_%' ESCAPE '!' be better?

Seems like a fine solution --- I was about to object that ESCAPE
doesn't go back as far as PG 7.0, but neither does pg_tablespace,
so that seems OK.

Or perhaps better, use a regular regex: spcname !~ '^pg_'. The
majority of the comparable cases in psql's describe.c do it this
way, and they seem more readable to me ...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Wong 2005-07-18 23:01:25 Re: A couple of patches for PostgreSQL 64bit support
Previous Message Andrew - Supernews 2005-07-18 18:13:16 Re: escape string syntax and pg_dumpall