Skip to content

Mark agtype_string_match_starts_with/_ends_with IMMUTABLE - #2579

Open
mmustafasenoglu wants to merge 1 commit into
apache:masterfrom
mmustafasenoglu:fix/string-match-immutable
Open

mmustafasenoglu wants to merge 1 commit into
apache:masterfrom
mmustafasenoglu:fix/string-match-immutable

Conversation

@mmustafasenoglu

Copy link
Copy Markdown
Contributor

Fixes #2576

starts_with and ends_with are pure string comparisons over their inputs, same as contains which is already IMMUTABLE, so there is no reason for them to stay STABLE. This unblocks user-built expression indexes on STARTS WITH / ENDS WITH predicates (Postgres rejects STABLE functions in index expressions).

Changes:

  • sql/agtype_string.sql: STABLE -> IMMUTABLE on the two functions

Same inputs always produce the same output with no catalog lookups
or session state, matching agtype_string_match_contains which is
already IMMUTABLE. Unblocks user-built expression indexes on
STARTS WITH / ENDS WITH predicates.

Fixes apache#2576
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mark agtype_string_match_starts_with / _ends_with IMMUTABLE (contains already is)

1 participant