Skip to content

Conversation

Mytherin
Copy link
Collaborator

@Mytherin Mytherin commented Nov 5, 2024

Supersedes #12359

This PR adds a new property to functions - FunctionCollationHandling. This can be used to handle collations across different functions in an easy way. There are three settings:

  • PROPAGATE_COLLATIONS (default): Propagate collations, but do not apply them. This means that if the function returns VARCHAR, and any of the input arguments are VARCHAR, the return type will inherit the collations of the input arguments.
  • PUSH_COMBINABLE_COLLATIONS: Propagates collations and applies combinable collations prior to calling the function. Combinable collations are "simple" collations like nocase and noaccent, but not icu collations that are more complex.
  • IGNORE_COLLATIONS: Ignore collations entirely.

PUSH_COMBINABLE_COLLATIONS is used for various functions, e.g. contains, starts_with, glob, like, etc:

D SELECT 'hello' COLLATE NOCASE LIKE '%HEL%' AS result;
┌─────────┐
│ result  │
│ boolean │
├─────────┤
│ true    │
└─────────┘

@Mytherin Mytherin merged commit 7ffe7a2 into duckdb:main Nov 6, 2024
40 checks passed
@Mytherin Mytherin deleted the collationpropagation branch December 8, 2024 06:51
github-actions bot pushed a commit to duckdb/duckdb-r that referenced this pull request Dec 21, 2024
Propagate collations through functions in a generic manner (duckdb/duckdb#14717)
github-actions bot added a commit to duckdb/duckdb-r that referenced this pull request Dec 21, 2024
Propagate collations through functions in a generic manner (duckdb/duckdb#14717)

Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
@Mytherin Mytherin mentioned this pull request Jan 7, 2025
1 task
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.

1 participant