File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818[package ]
1919name = " pgmold-sqlparser"
2020description = " Fork of sqlparser with additional PostgreSQL features (PARTITION OF, SECURITY DEFINER/INVOKER, SET params)"
21- version = " 0.60.4 "
21+ version = " 0.60.5 "
2222authors = [" Filipe Guerreiro <filipe.m.guerreiro@gmail.com>" ]
2323homepage = " https://github.com/fmguerreiro/datafusion-sqlparser-rs"
2424documentation = " https://docs.rs/pgmold-sqlparser/"
Original file line number Diff line number Diff line change @@ -478,6 +478,11 @@ pub enum DataType {
478478 ///
479479 /// [PostgreSQL]: https://www.postgresql.org/docs/current/plpgsql-trigger.html
480480 Trigger ,
481+ /// SETOF type modifier for [PostgreSQL] function return types,
482+ /// e.g. `CREATE FUNCTION ... RETURNS SETOF text`.
483+ ///
484+ /// [PostgreSQL]: https://www.postgresql.org/docs/current/sql-createfunction.html
485+ SetOf ( Box < DataType > ) ,
481486 /// Any data type, used in BigQuery UDF definitions for templated parameters, see [BigQuery].
482487 ///
483488 /// [BigQuery]: https://cloud.google.com/bigquery/docs/user-defined-functions#templated-sql-udf-parameters
@@ -794,6 +799,7 @@ impl fmt::Display for DataType {
794799 }
795800 DataType :: Unspecified => Ok ( ( ) ) ,
796801 DataType :: Trigger => write ! ( f, "TRIGGER" ) ,
802+ DataType :: SetOf ( inner) => write ! ( f, "SETOF {inner}" ) ,
797803 DataType :: AnyType => write ! ( f, "ANY TYPE" ) ,
798804 DataType :: Table ( fields) => match fields {
799805 Some ( fields) => {
Original file line number Diff line number Diff line change @@ -921,6 +921,7 @@ define_keywords!(
921921 SESSION_USER ,
922922 SET ,
923923 SETERROR ,
924+ SETOF ,
924925 SETS ,
925926 SETTINGS ,
926927 SHARE ,
Original file line number Diff line number Diff line change @@ -11354,6 +11354,10 @@ impl<'a> Parser<'a> {
1135411354 Ok(DataType::Tuple(field_defs))
1135511355 }
1135611356 Keyword::TRIGGER => Ok(DataType::Trigger),
11357+ Keyword::SETOF => {
11358+ let inner = self.parse_data_type()?;
11359+ Ok(DataType::SetOf(Box::new(inner)))
11360+ }
1135711361 Keyword::ANY if self.peek_keyword(Keyword::TYPE) => {
1135811362 let _ = self.parse_keyword(Keyword::TYPE);
1135911363 Ok(DataType::AnyType)
You can’t perform that action at this time.
0 commit comments