Improve parsing performance by reducing token cloning (#1587)

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
Paul J. Davis 2024-12-24 16:19:35 -06:00 committed by GitHub
parent 024a878ee7
commit df3c5652b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 344 additions and 244 deletions

View file

@ -52,11 +52,11 @@ impl Parser<'_> {
/// [PostgreSQL](https://www.postgresql.org/docs/current/sql-alterpolicy.html)
pub fn parse_alter_policy(&mut self) -> Result<Statement, ParserError> {
let name = self.parse_identifier(false)?;
self.expect_keyword(Keyword::ON)?;
self.expect_keyword_is(Keyword::ON)?;
let table_name = self.parse_object_name(false)?;
if self.parse_keyword(Keyword::RENAME) {
self.expect_keyword(Keyword::TO)?;
self.expect_keyword_is(Keyword::TO)?;
let new_name = self.parse_identifier(false)?;
Ok(Statement::AlterPolicy {
name,
@ -232,7 +232,7 @@ impl Parser<'_> {
Some(Keyword::BYPASSRLS) => RoleOption::BypassRLS(true),
Some(Keyword::NOBYPASSRLS) => RoleOption::BypassRLS(false),
Some(Keyword::CONNECTION) => {
self.expect_keyword(Keyword::LIMIT)?;
self.expect_keyword_is(Keyword::LIMIT)?;
RoleOption::ConnectionLimit(Expr::Value(self.parse_number_value()?))
}
Some(Keyword::CREATEDB) => RoleOption::CreateDB(true),
@ -256,7 +256,7 @@ impl Parser<'_> {
Some(Keyword::SUPERUSER) => RoleOption::SuperUser(true),
Some(Keyword::NOSUPERUSER) => RoleOption::SuperUser(false),
Some(Keyword::VALID) => {
self.expect_keyword(Keyword::UNTIL)?;
self.expect_keyword_is(Keyword::UNTIL)?;
RoleOption::ValidUntil(Expr::Value(self.parse_value()?))
}
_ => self.expected("option", self.peek_token())?,

File diff suppressed because it is too large Load diff