diff --git a/src/fdw/trigger.rs b/src/fdw/trigger.rs index d035ee99..7ac2f334 100644 --- a/src/fdw/trigger.rs +++ b/src/fdw/trigger.rs @@ -281,11 +281,7 @@ fn construct_alter_table_statement( column_name.to_string() }; - format!( - "ADD COLUMN {} {}", - spi::quote_identifier(column_name), - pg_type - ) + format!("ADD COLUMN {} {}", column_name, pg_type) }) .collect(); diff --git a/tests/tests/fixtures/arrow.rs b/tests/tests/fixtures/arrow.rs index 0c004d68..f7caa58c 100644 --- a/tests/tests/fixtures/arrow.rs +++ b/tests/tests/fixtures/arrow.rs @@ -245,10 +245,15 @@ pub fn primitive_record_batch_single() -> Result { } pub fn reserved_column_record_batch() -> Result { - // INTEGER authorization is a reserved column name + // authorization is a reserved column name let fields = vec![ - Field::new("INTEGER", DataType::Int32, false), + Field::new("id", DataType::Utf8, false), + Field::new("operation_id", DataType::Utf8, false), + Field::new("order_id", DataType::Utf8, false), + Field::new("dealer_id", DataType::Utf8, false), + Field::new("dealer_name", DataType::Utf8, false), Field::new("authorization", DataType::Utf8, false), + Field::new("on_day", DataType::Boolean, false), ]; let schema = Arc::new(Schema::new(fields)); @@ -256,12 +261,25 @@ pub fn reserved_column_record_batch() -> Result { Ok(RecordBatch::try_new( schema, vec![ - Arc::new(Int32Array::from(vec![1, 2, 3])), + Arc::new(StringArray::from(vec![Some("1"), Some("2"), Some("3")])), + Arc::new(StringArray::from(vec![Some("1"), Some("2"), Some("3")])), + Arc::new(StringArray::from(vec![Some("1"), Some("2"), Some("3")])), + Arc::new(StringArray::from(vec![Some("1"), Some("2"), Some("3")])), + Arc::new(StringArray::from(vec![ + Some("Jason"), + Some("Alice"), + Some("Bob"), + ])), Arc::new(StringArray::from(vec![ Some("auth_1"), Some("auth_2"), Some("auth_3"), ])), + Arc::new(BooleanArray::from(vec![ + Some(true), + Some(false), + Some(true), + ])), ], )?) } diff --git a/tests/tests/table_config.rs b/tests/tests/table_config.rs index d01077c7..3bd247da 100644 --- a/tests/tests/table_config.rs +++ b/tests/tests/table_config.rs @@ -105,7 +105,7 @@ fn test_reserved_column_name(mut conn: PgConnection, tempdir: TempDir) -> Result setup_parquet_wrapper_and_server().execute(&mut conn); match format!( - "CREATE FOREIGN TABLE reserved_table_name () SERVER parquet_server OPTIONS (files '{}')", + "CREATE FOREIGN TABLE reserved_table_name () SERVER parquet_server OPTIONS (files '{}', preserve_casing 'true')", parquet_path.to_str().unwrap() ) .execute_result(&mut conn)