feat: support keyword rowid

This commit is contained in:
Kould
2025-01-03 01:42:36 +08:00
parent 55e79a72c1
commit 5305a9d0fd
7 changed files with 111 additions and 26 deletions

View File

@@ -194,6 +194,9 @@ impl CreateTableBody {
{
let mut generated_count = 0;
for c in columns.values() {
if c.col_name == "rowid" {
return Err(custom_err!("cannot use reserved word: ROWID"));
}
for cs in &c.constraints {
if let ColumnConstraint::Generated { .. } = cs.constraint {
generated_count += 1;

View File

@@ -728,6 +728,7 @@ impl ToTokens for Expr {
}
s.append(TK_RP, None)
}
Self::RowId { .. } => Ok(()),
Self::Subquery(query) => {
s.append(TK_LP, None)?;
query.to_tokens(s)?;

View File

@@ -338,6 +338,13 @@ pub enum Expr {
/// is the column a rowid alias
is_rowid_alias: bool,
},
/// `ROWID`
RowId {
/// the x in `x.y.z`. index of the db in catalog.
database: Option<usize>,
/// the y in `x.y.z`. index of the table in catalog.
table: usize,
},
/// `IN`
InList {
/// expression