mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-22 06:54:07 +00:00
Add support for generated virtual columns with expression (#1051)
This commit is contained in:
parent
541d684fba
commit
640b9394cd
5 changed files with 76 additions and 30 deletions
|
@ -205,6 +205,18 @@ fn parse_create_sqlite_quote() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_create_table_gencol() {
|
||||
let sql_default = "CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a * 2))";
|
||||
sqlite_and_generic().verified_stmt(sql_default);
|
||||
|
||||
let sql_virt = "CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a * 2) VIRTUAL)";
|
||||
sqlite_and_generic().verified_stmt(sql_virt);
|
||||
|
||||
let sql_stored = "CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a * 2) STORED)";
|
||||
sqlite_and_generic().verified_stmt(sql_stored);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_placeholder() {
|
||||
// In postgres, this would be the absolute value operator '@' applied to the column 'xxx'
|
||||
|
@ -435,7 +447,6 @@ fn sqlite_with_options(options: ParserOptions) -> TestedDialects {
|
|||
|
||||
fn sqlite_and_generic() -> TestedDialects {
|
||||
TestedDialects {
|
||||
// we don't have a separate SQLite dialect, so test only the generic dialect for now
|
||||
dialects: vec![Box::new(SQLiteDialect {}), Box::new(GenericDialect {})],
|
||||
options: None,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue