synth icon indicating copy to clipboard operation
synth copied to clipboard

Support `tstzrange` for PostgreSQL

Open JonasCir opened this issue 3 years ago • 3 comments
trafficstars

Required Functionality I want to use synth on a PostgreSQL DB, however, it does not feature a converter for tstzrange.

Proposed Solution Implement a converter for tstzrange.

Use case I really want to use synth, but currently I'm blocked :)

JonasCir avatar Feb 16 '22 09:02 JonasCir

@JonasCir thanks for the suggestion!!

I am not familiar with the range PostgreSQL type though. It seems like it stores the two numbers (lower and upper) of a range? And then all the values in the range is represented by the range?

chesedo avatar Feb 16 '22 15:02 chesedo

https://www.postgresql.org/docs/current/rangetypes.html

Seems like it :D An entry in the table has a

  • subtype (integer, bigint, numeric, timestamp without TZ, timestamp with TZ, date)
  • lower bound
  • upper bound where
  • bounds can be inclusive or exclusive
  • bounds can be removed, meaning they are infinite

So generation appears to be a random choice of bounds for the subtype.

fake-rs seems to support DateTimeBetween which goes into the right direction, we need the same for timestamps with timezone, however.

JonasCir avatar Feb 16 '22 15:02 JonasCir

This would be required before we can use Synth for our projects. We use this tstzrange values in a lot of places. I don't know if you would need to support the more generic range types.

simon-mottram-cucumber avatar Apr 01 '22 00:04 simon-mottram-cucumber