mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-26 21:56:17 +00:00
feat: impl create table sql execution (#168)
* catalog manager allocates table id * rebase develop * add some tests * add some more test * fix some cr comments * insert into system catalog * use slice pattern to simplify code * add optional dependencies * add sql-to-request test * successfully recover * fix unit tests * rebase develop * add some tests * fix some cr comments * fix some cr comments * add a lock to CatalogManager * feat: add gmt_created and gmt_modified columns to system catalog table
This commit is contained in:
+4
-1
@@ -1 +1,4 @@
|
||||
pub use sqlparser::ast::{ColumnDef, Expr, Ident, ObjectName, SqlOption, TableConstraint, Value};
|
||||
pub use sqlparser::ast::{
|
||||
ColumnDef, ColumnOption, ColumnOptionDef, DataType, Expr, Ident, ObjectName, SqlOption,
|
||||
TableConstraint, Value,
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::statements::statement::Statement;
|
||||
|
||||
const ENGINE: &str = "ENGINE";
|
||||
|
||||
/// Pasre create [table] statement
|
||||
/// Parses create [table] statement
|
||||
impl<'a> ParserContext<'a> {
|
||||
pub(crate) fn parse_create(&mut self) -> Result<Statement> {
|
||||
self.parser
|
||||
@@ -42,6 +42,7 @@ impl<'a> ParserContext<'a> {
|
||||
engine,
|
||||
constraints,
|
||||
options,
|
||||
table_id: 0, // table id is assigned by catalog manager
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ pub const TIME_INDEX: &str = "__time_index";
|
||||
pub struct CreateTable {
|
||||
/// Create if not exists
|
||||
pub if_not_exists: bool,
|
||||
pub table_id: u32,
|
||||
/// Table name
|
||||
pub name: ObjectName,
|
||||
pub columns: Vec<ColumnDef>,
|
||||
|
||||
Reference in New Issue
Block a user