erleans / pgo

Erlang Postgres client and connection pool
Apache License 2.0
80 stars 16 forks source link

Timestamp with time zone #70

Open lpil opened 1 year ago

lpil commented 1 year ago

Hello!

How can one insert and fetch timestamps with time zones? I can only work out how to use Erlang timestamp tuples, which does not contain time zone information.

Cheers, Louis

tsloughter commented 1 year ago

Doesn't look supported at the moment. I think it is pretty simple to add as a basic "offset from UTC" field in a tuple tho, so I can try to knock that out soon.

PascalLeMerrer commented 1 year ago

Hello. I would be interested too in this fix.

lpil commented 5 days ago

Hello! I've hit up against this again. Did you have any thoughts on the format to use? Perhaps someone could contribute something

tsloughter commented 4 days ago

@lpil sorry, no. @chiroptical says they are taking a look. I think I saw the "offset from UTC" in epgsql. I assume postgrex has some struct so not really a format we can copy.

tsloughter commented 4 days ago

Yea, https://github.com/epgsql/epgsql/blob/64aed378455ec3a45c41826896c5561491ff4f7a/src/datatypes/epgsql_codec_datetime.erl#L40

lpil commented 3 days ago

Looks good! Will need a pg_datetimez too I think? I can't see that here

tsloughter commented 3 days ago

Huh.. you'd think so, but I don't see one in the postgres docs.

lpil commented 3 days ago

https://www.postgresql.org/docs/current/datatype-datetime.html

"Timestamp with time zone", isn't that it?

tsloughter commented 2 days ago

@lpil I don't see a datetimetz mentioned in there.

lpil commented 1 day ago

I don't know what you mean, sorry. I linked it? "Timestamp with time zone".