mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user