Yes VARCHAR preserves trailing spaces. But your question is more about the semantics of CHAR. The literal is a CHAR(2). I think we should retain the trailing space in that string when we reinterpret it as a VARCHAR. But I’m not sure that we do.
> On Dec 2, 2024, at 7:40 PM, Mihai Budiu <mbu...@gmail.com> wrote: > > What is the meaning of VARCHAR(N) and VARCHAR in Calcite? > Does VARCHAR preserve trailing spaces? > What is the output of this query > > SELECT CAST('x ' AS VARCHAR) || 'y' > > Mihai