-
Notifications
You must be signed in to change notification settings - Fork 670
Support PostgreSQL C Functions with Multiple AS Parameters #2095
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
base: main
Are you sure you want to change the base?
Support PostgreSQL C Functions with Multiple AS Parameters #2095
Conversation
…arguments and flexible attribute order
| let mut exprs = vec![first_expr]; | ||
| exprs.extend(self.parse_comma_separated(parse_string_expr)?); | ||
| Ok(Expr::Tuple(exprs)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, does wrapping this in a Tuple not include a parenthesis (first_expr, second_expr) when displaying the AST? wondering if/how we worked around that somehow in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah simply the following happens:
if let Some(CreateFunctionBody::AsBeforeOptions(function_body)) = &self.function_body {
write!(f, " AS ")?;
// Special handling for tuple expressions to format without parentheses
// PostgreSQL C functions use: AS 'obj_file', 'link_symbol'
// rather than: AS ('obj_file', 'link_symbol')
if let Expr::Tuple(exprs) = function_body {
write!(f, "{}", display_comma_separated(exprs))?;
} else {
write!(f, "{function_body}")?;
}
}
Enables parsing of PostgreSQL C language functions that specify both object file and link symbol in the
ASclause.Example
Fixes #2093