Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please support "alter table owner to" in Postgres #1293

Closed
gainings opened this issue May 29, 2024 · 1 comment · Fixed by #1314
Closed

Please support "alter table owner to" in Postgres #1293

gainings opened this issue May 29, 2024 · 1 comment · Fixed by #1314

Comments

@gainings
Copy link
Contributor

gainings commented May 29, 2024

Version

sqlparser = "0.46.0"

https://www.postgresql.org/docs/16/sql-altertable.html

use sqlparser::dialect::PostgreSqlDialect;
use sqlparser::parser::Parser;

fn main() {

    let sql = "-- auto-generated definition
    alter table my_table owner to my_user";

    let dialect = PostgreSqlDialect {}; // or AnsiDialect, or your own dialect ...

    let ast = Parser::parse_sql(&dialect, sql).unwrap();

    println!("AST: {:?}", ast);
}
thread 'main' panicked at src/main.rs:11:48:
called `Result::unwrap()` on an `Err` value: ParserError("Expected ADD, RENAME, PARTITION, SWAP, DROP, or SET TBLPROPERTIES after ALTER TABLE, found: owner at Line: 2, Column 26")
stack backtrace:
   0: rust_begin_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1653:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1077:23
   4: sqlreviewer::main
             at ./src/main.rs:11:15
   5: core::ops::function::FnOnce::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Process finished with exit code 101

@alamb
Copy link
Contributor

alamb commented May 29, 2024

Thank you for the suggestion. This sounds like a good idea to me.

Any contributions for fix would be welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants