diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2019-04-15 09:26:23 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2019-04-15 09:29:17 +0200 |
commit | abb9c63b2c00109183cdb9f588d2f23fc383ed38 (patch) | |
tree | 0ad13c544a03873ed8c5ec0ec08d717e9fd0b62d /src/backend/utils/adt/like_support.c | |
parent | c34677fdaa73f089d557554a9cd479b9bd5b5143 (diff) | |
download | postgresql-abb9c63b2c00109183cdb9f588d2f23fc383ed38.tar.gz postgresql-abb9c63b2c00109183cdb9f588d2f23fc383ed38.zip |
Unbreak index optimization for LIKE on bytea
The same code is used to handle both text and bytea, but bytea is not
collation-aware, so we shouldn't call get_collation_isdeterministic()
in that case, since that will error out with an invalid collation.
Reported-by: Jeevan Chalke <jeevan.chalke@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/CAM2%2B6%3DWaf3qJ1%3DyVTUH8_yG-SC0xcBMY%2BSFLhvKKNnWNXSUDBw%40mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/like_support.c')
-rw-r--r-- | src/backend/utils/adt/like_support.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/utils/adt/like_support.c b/src/backend/utils/adt/like_support.c index a65e63736c4..7528c80f7c3 100644 --- a/src/backend/utils/adt/like_support.c +++ b/src/backend/utils/adt/like_support.c @@ -267,8 +267,10 @@ match_pattern_prefix(Node *leftop, * precise error messages.) (It should be possible to support at least * Pattern_Prefix_Exact, but no point as along as the actual * pattern-matching implementations don't support it.) + * + * expr_coll is not set for a non-collation-aware data type such as bytea. */ - if (!get_collation_isdeterministic(expr_coll)) + if (expr_coll && !get_collation_isdeterministic(expr_coll)) return NIL; /* |