Skip to content

Commit

Permalink
Changelog.
Browse files Browse the repository at this point in the history
Add TRIM, LTRIM and RTRIM to Postgres.
  • Loading branch information
jdunkerley committed Apr 19, 2023
1 parent 412045d commit 10124ba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@
- [Implemented `Table.union` for the Database backend.][6204]
- [Array & Vector have the same methods & behavior][6218]
- [Implemented `Table.split` and `Table.tokenize` for in-memory tables.][6233]
- [Added `trim` and `replace` to `Column`. Enhanced number parsing with support
for thousands and decimal point automatic detection.][6253]

[debug-shortcuts]:
https://github.com/enso-org/enso/blob/develop/app/gui/docs/product/shortcuts.md#debug
Expand Down Expand Up @@ -583,6 +585,7 @@
[6077]: https://github.com/enso-org/enso/pull/6077
[6218]: https://github.com/enso-org/enso/pull/6218
[6233]: https://github.com/enso-org/enso/pull/6233
[6253]: https://github.com/enso-org/enso/pull/6253

#### Enso Compiler

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ type Postgres_Dialect
## PRIVATE
make_internal_generator_dialect =
cases = [["LOWER", Base_Generator.make_function "LOWER"], ["UPPER", Base_Generator.make_function "UPPER"]]
text = [starts_with, contains, ends_with, agg_shortest, agg_longest, make_case_sensitive]+concat_ops+cases
text = [starts_with, contains, ends_with, agg_shortest, agg_longest, make_case_sensitive]+concat_ops+cases+trim_ops
counts = [agg_count_is_null, agg_count_empty, agg_count_not_empty, ["COUNT_DISTINCT", agg_count_distinct], ["COUNT_DISTINCT_INCLUDE_NULL", agg_count_distinct_include_null]]
arith_extensions = [is_nan, decimal_div, mod_op, ["ROW_MIN", Base_Generator.make_function "LEAST"], ["ROW_MAX", Base_Generator.make_function "GREATEST"]]
bool = [bool_or]
Expand Down Expand Up @@ -270,6 +270,14 @@ concat_ops =
concat = Base_Generator.make_concat make_raw_concat_expr make_contains_expr
[["CONCAT", concat (has_quote=False)], ["CONCAT_QUOTE_IF_NEEDED", concat (has_quote=True)]]

## PRIVATE
trim_ops =
make_fn fn_name = Base_Generator.lift_binary_op fn_name input-> chars-> case chars of
Nothing -> Builder.code fn_name+"(" ++ input ++ ")"
_ : Text -> Builder.code fn_name+"(" ++ input ++ ", " ++ (Builder.interpolation chars) ++ ")"
_ -> Builder.code fn_name+"(" ++ input ++ ", " ++ chars ++ ")"
[make_fn "TRIM", make_fn "LTRIM", make_fn "RTRIM"]

## PRIVATE
agg_count_distinct args = if args.is_empty then (Error.throw (Illegal_Argument.Error "COUNT_DISTINCT requires at least one argument.")) else
case args.length == 1 of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,13 @@ concat_ops =
concat = Base_Generator.make_concat make_raw_concat_expr make_contains_expr
[["CONCAT", concat (has_quote=False)], ["CONCAT_QUOTE_IF_NEEDED", concat (has_quote=True)]]


## PRIVATE
trim_ops =
make_fn fn_name = Base_Generator.lift_binary_op fn_name input-> chars-> case chars of
Nothing -> Builder.code fn_name+"(" ++ input ++ ")"
_ : Text -> Builder.code fn_name+"(" ++ input ++ ", " ++ (Builder.interpolation chars) ++ ")"
_ -> Builder.code fn_name+"(" ++ input ++ ", " ++ chars ++ ")"
[make_fn "TRIM", make_fn "LTRIM"]
[make_fn "TRIM", make_fn "LTRIM", make_fn "RTRIM"]

## PRIVATE
agg_count_distinct args = case args.length == 1 of
Expand Down

0 comments on commit 10124ba

Please sign in to comment.