\ escapes in check constraint strings?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: pgsql-bugs(at)postgresql(dot)org
Subject: \ escapes in check constraint strings?
Date: 2004-07-16 21:49:25
Message-ID: 20040716214925.GA8688@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I see the following behaivor on 7.4.3 and 7.4 stable from about a week ago:
bruno=> create table test ();
CREATE TABLE
bruno=> alter table test add constraint test2 check('\\' = '');
ALTER TABLE
bruno=> \d test
Table "public.test"
Column | Type | Modifiers
--------+------+-----------
Check constraints:
"test2" CHECK ('\\'::text = ''::text)

bruno=> select '\\';
?column?
----------
\
(1 row)

I didn't see \\ left as \\ in at least some 7.3 versions.

I think this is a bug, but maybe there are different escape rules for
strings in check constraints.

In the real case that this derives from I was getting a different number
of backslashes than I expected in a regular expression.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruno Wolff III 2004-07-16 22:01:40 Re: \ escapes in check constraint strings?
Previous Message Stephan Szabo 2004-07-16 20:16:04 Re: Replace function BUG