Skip to content

[Feature] Add VARCHAR(max_length) to type system for user-specified variable-length string limit #26

@shirly121

Description

@shirly121

Is your feature request related to a problem? Please describe.
In the current neug type system, variable-length strings are described via string.var_char in schema YAML with optional max_length (e.g. max_length: 65536), but there is no user-facing, explicit VARCHAR(max_length) type. Users cannot use syntax like VARCHAR(256) in DDL or queries to specify the maximum length of variable-length strings, which hinders clear semantics and storage/validation optimizations.

Describe the solution you'd like
Add VARCHAR(max_length) to the neug type system so that users can explicitly specify the maximum length of variable-length strings, for example:

  • Support syntax such as VARCHAR(256) and VARCHAR(1024) in DDL or schema definitions;
  • Map internally to the existing LogicalType::STRING(max_length) and VarcharExtraInfo;
  • Keep semantics consistent with the current YAML schema string.var_char.max_length and handle parsing, validation, and serialization uniformly.

Describe alternatives you've considered

  • Rely only on existing YAML var_char.max_length: no DDL/syntax-level VARCHAR(n), so users must hand-write YAML in schema files, which does not align well with unified DDL and tooling.
  • Use a fixed default max length (e.g. 65536): users cannot lower the limit when needed, which is less ideal for storage and constraints.

Additional context

  • The codebase already has VARCHAR_DEFAULT_LENGTH, VarcharExtraInfo, LogicalType::STRING(size_t max_length), and YAML parsing for string.var_char.max_length (see g_type_utils.h, types.h, modern_schema.yaml). This request is mainly to add explicit VARCHAR(max_length) support and consistent exposure at the type system’s external interface.

Metadata

Metadata

Labels

compilerCompiler infrastructurestoreStorage layer

Projects

Status

To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions