lovasoa commented on code in PR #1526:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1526#discussion_r1845353716
##########
src/ast/query.rs:
##########
@@ -1610,6 +1610,40 @@ impl fmt::Display for TableAlias {
}
}
+/// SQL column definition in a table expression alias.
+/// Most of the time, the data type is not specified.
+/// But some table-valued functions do require specifying the data type.
+///
+/// See
<https://www.postgresql.org/docs/17/queries-table-expressions.html#QUERIES-TABLEFUNCTIONS>
+#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
+pub struct TableAliasColumnDef {
+ /// Column name alias
+ pub name: Ident,
+ /// Some table-valued functions require specifying the data type in the
alias.
+ pub data_type: Option<DataType>,
+}
+
+impl TableAliasColumnDef {
+ pub fn from_column_name(name: &str) -> Self {
+ TableAliasColumnDef {
+ name: Ident::new(name),
+ data_type: None,
+ }
+ }
Review Comment:
Ok, I renamed it to `from_name` and made it generic !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]