Skip to content

tb does not support not null and default column value when creating table #201

@ygf11

Description

@ygf11

when I create table with not null or default column value , server reports error:

  1. sql: CREATE TABLE person(  person_idUInt64,  nick_name String DEFAULT '123') ENGINE = BaseStorage PARTITION BY person_id
  2. 08:37:48 [DEBUG] (11) server: Found error: Unsupported language feature found

I found it does not support this now. Supporting not null syntax is easy, we can add not null matching in Rule::column_constraint, like:

 Rule::column_constraint => {
                let col = self
                    .tab
                    .columns
                    .last_mut()
                    .ok_or(LangError::CreateTableParsingError)?;
                let constr = pair.as_str().trim().to_ascii_uppercase();
                match constr.as_str() {
                    "PRIMARY KEY" => col.1.is_primary_key = true, 
                    "NOT NULL" => col.1.is_nullable = false,
                    _ => 
                        return Err(LangError::UnsupportedLangFeatureError),
                };
            }

but it need more works to support default value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions