Skip to content

Commit

Permalink
gen timestamp with time zone
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel committed Dec 30, 2022
1 parent d740a99 commit 0fff740
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/tests/sqlsmith/src/sql_gen/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ impl<'a, R: Rng> SqlGenerator<'a, R> {
let tm = DateTime::<Utc>::from(SystemTime::now() - Duration::from_secs(*secs));
match typ {
T::Date => tm.format("%F").to_string(),
T::Timestamp | T::Timestamptz => tm.format("%Y-%m-%d %H:%M:%S").to_string(),
T::Timestamp => tm.format("%Y-%m-%d %H:%M:%S").to_string(),
T::Timestamptz => {
let timestamp = tm.format("%Y-%m-%d %H:%M:%S");
let timezone = self.rng.gen_range(0..=15);
format!("{}+{}", timestamp, timezone)
}
T::Time => tm.format("%T").to_string(),
T::Interval => secs.to_string(),
_ => unreachable!(),
Expand Down

0 comments on commit 0fff740

Please sign in to comment.