Re: escape string syntax and pg_dumpall - Mailing list pgsql-hackers

From Tom Lane
Subject Re: escape string syntax and pg_dumpall
Date
Msg-id 15930.1121713291@sss.pgh.pa.us
Whole thread Raw
In response to Re: escape string syntax and pg_dumpall  (Andrew - Supernews <andrew+nonews@supernews.com>)
Responses Re: escape string syntax and pg_dumpall  (Patrick Welche <prlw1@newn.cam.ac.uk>)
List pgsql-hackers
Andrew - Supernews <andrew+nonews@supernews.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


pgsql-hackers by date:

Previous
From: Andrew - Supernews
Date:
Subject: Re: escape string syntax and pg_dumpall
Next
From: Dave Cramer
Date:
Subject: build farm failure tuna on OSX 10.4 for 8.0