Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
sqld: allow CREATE VIEW and DROP VIEW
Browse files Browse the repository at this point in the history
... but disallow CREATE TEMP VIEW.

Examples:
 →  create temp view v as select v from t;
 Error: failed to execute SQL: create temp view v as select v from t;
 unsupported statement
 →  create view v as select v from t;
 →  drop view v;

Fixes #563
  • Loading branch information
psarna committed Jul 31, 2023
1 parent 919bee1 commit 4f4fa84
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sqld/src/query_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ impl StmtKind {
) => Some(Self::Write),
Cmd::Stmt(Stmt::Select { .. }) => Some(Self::Read),
Cmd::Stmt(Stmt::Pragma(name, body)) => Self::pragma_kind(name, body.as_ref()),
// Creating regular views is OK, temporary views are bound to a connection
// and thus disallowed in sqld.
Cmd::Stmt(Stmt::CreateView {
temporary: false, ..
}) => Some(Self::Write),
Cmd::Stmt(Stmt::DropView { .. }) => Some(Self::Write),
_ => None,
}
}
Expand Down

0 comments on commit 4f4fa84

Please sign in to comment.