From: | Marc Munro <marc(at)bloodnok(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Looking for "proper" escape string syntax from pg_get_constraintdef |
Date: | 2009-08-31 15:31:55 |
Message-ID: | 1251732715.30485.12.camel@bloodnok.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I am trying to recreate a domain definition from information in
pg_catalog and getting the following warnings:
WARNING: nonstandard use of \\ in a string literal
LINE 3: CHECK (((VALUE ~ '^\\d{4}$'::text) OR (VALUE ~ '^\\d{5}-\\...
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
WARNING: nonstandard use of \\ in a string literal
LINE 3: CHECK (((VALUE ~ '^\\d{4}$'::text) OR (VALUE ~ '^\\d{5}-\\...
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
My original domain definition is this:
create domain "public"."us_postal_code"
as "pg_catalog"."text"
CHECK (((VALUE ~ E'^\\d{4}$'::text) OR (VALUE ~ E'^\\d{5}-\\d{4}$'::text)));
but retrieving the constraint definition using pg_get_constraintdef(oid)
gives me this:
CHECK (((VALUE ~ '^\\d{4}$'::text) OR (VALUE ~ '^\\d{5}-\\d{4}$'::text)))
How can I get the constraint definition with proper escaping from the
catalog? Is there another function I should be using?
__
Marc
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-08-31 15:40:40 | Re: Looking for "proper" escape string syntax from pg_get_constraintdef |
Previous Message | Adrian Klaver | 2009-08-31 14:53:08 | Re: print/return only the first X chars of a varchar column? |