Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link

Description

@ygf11
Issue body actions

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.

Reactions are currently unavailable

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

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.