Skip to content

Commit

Permalink
Fix compatibility with pg 9.5 and lower (#11)
Browse files Browse the repository at this point in the history
The automatic tlist implementation doesn't cope well with fields defined as
Option, as it relies on stringify to generate the target SQL type.

For now just intercept any field defined as Option<Text>, as the only problems
happens in pg_aggregate.rs on pg 9.5 and below, but I should eventually find a
better solution.
  • Loading branch information
rjuju authored Feb 15, 2025
1 parent bf4bfce commit 4ddabfd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,16 @@ macro_rules! DbStruct {
|| typname == "classoptions"
{
typname = String::from("text[]");
} else if typname == "option<text>" {
// FIXME should find a way to handle any Option<>
typname = String::from("text");
}

tlist.push(format!(
"NULL::{} AS {}",
typname,
stringify!($field),
)
);
));
}
)*
tlist
Expand Down

0 comments on commit 4ddabfd

Please sign in to comment.