iffyio commented on code in PR #1889: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1889#discussion_r2159880917
########## tests/sqlparser_postgres.rs: ########## @@ -6201,3 +6201,49 @@ fn parse_alter_table_replica_identity() { _ => unreachable!(), } } + +#[test] +fn parse_tsvector_datatype() { + match pg_and_generic().verified_stmt("CREATE TABLE foo (x TSVECTOR)") { + Statement::CreateTable(CreateTable { columns, .. }) => { + assert_eq!( + columns, + vec![ColumnDef { + name: "x".into(), + data_type: DataType::TsVector, + options: vec![], + }] + ); + } + _ => unreachable!(), + } +} + +#[test] +fn parse_tsquery_datatype() { + match pg_and_generic().verified_stmt("CREATE TABLE foo (x TSQUERY)") { + Statement::CreateTable(CreateTable { columns, .. }) => { + assert_eq!( + columns, + vec![ColumnDef { + name: "x".into(), + data_type: DataType::TsQuery, + options: vec![], + }] + ); + } + _ => unreachable!(), + } +} + +#[test] +fn parse_to_tsvector_function() { + let sql = "SELECT to_tsvector('english', 'foo bar baz')"; + pg_and_generic().verified_only_select(sql); +} + +#[test] +fn parse_to_tsquery_function() { + let sql = "SELECT to_tsquery('Fat:ab & Cats')"; + pg_and_generic().verified_only_select(sql); +} Review Comment: are these testing anything specific? If not feels like we can skip them given we have existing tests for functions ########## tests/sqlparser_postgres.rs: ########## @@ -6201,3 +6201,49 @@ fn parse_alter_table_replica_identity() { _ => unreachable!(), } } + +#[test] +fn parse_tsvector_datatype() { + match pg_and_generic().verified_stmt("CREATE TABLE foo (x TSVECTOR)") { + Statement::CreateTable(CreateTable { columns, .. }) => { + assert_eq!( + columns, + vec![ColumnDef { + name: "x".into(), + data_type: DataType::TsVector, + options: vec![], + }] + ); + } + _ => unreachable!(), + } +} + +#[test] +fn parse_tsquery_datatype() { + match pg_and_generic().verified_stmt("CREATE TABLE foo (x TSQUERY)") { + Statement::CreateTable(CreateTable { columns, .. }) => { Review Comment: Could we merge both tests into the same function? maybe a generic `parse_pg_datatypes()` function -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org