diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-05-28 18:18:19 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-05-28 18:18:19 +0000 |
commit | ece869b11eedd082ccd0bbd73ab9013c9ad9fa13 (patch) | |
tree | 1401273a3b3b547841cc4662764f09774f4ade78 /src/backend/utils/adt/like_match.c | |
parent | 9b94e3696e7b6c7c13db3e593d0fa471c3bce9bc (diff) | |
download | postgresql-ece869b11eedd082ccd0bbd73ab9013c9ad9fa13.tar.gz postgresql-ece869b11eedd082ccd0bbd73ab9013c9ad9fa13.zip |
Fix oversight in the previous patch that made LIKE throw error for \ at the
end of the pattern: the code path that handles \ just after % should throw
error too. As in the previous patch, not back-patching for fear of breaking
apps that worked before.
Diffstat (limited to 'src/backend/utils/adt/like_match.c')
-rw-r--r-- | src/backend/utils/adt/like_match.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/utils/adt/like_match.c b/src/backend/utils/adt/like_match.c index b67ba020cf3..be3b9515dfe 100644 --- a/src/backend/utils/adt/like_match.c +++ b/src/backend/utils/adt/like_match.c @@ -19,7 +19,7 @@ * Copyright (c) 1996-2010, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.28 2010/05/28 17:35:23 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.29 2010/05/28 18:18:19 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -158,7 +158,9 @@ MatchText(char *t, int tlen, char *p, int plen) if (*p == '\\') { if (plen < 2) - return LIKE_FALSE; /* XXX should throw error */ + ereport(ERROR, + (errcode(ERRCODE_INVALID_ESCAPE_SEQUENCE), + errmsg("LIKE pattern must not end with escape character"))); firstpat = GETCHAR(p[1]); } else |