mz_expr/scalar/func/impls/varchar.rs
1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
9
10use mz_expr_derive::sqlfunc;
11use mz_repr::adt::varchar::VarChar;
12
13// This function simply allows the expression of changing a's type from varchar to string
14#[sqlfunc(
15 sqlname = "varchar_to_text",
16 preserves_uniqueness = true,
17 is_eliminable_cast = true,
18 inverse = to_unary!(super::CastStringToVarChar {
19 length: None,
20 fail_on_len: false,
21 }),
22)]
23fn cast_var_char_to_string<'a>(a: VarChar<&'a str>) -> &'a str {
24 a.0
25}