Closed YurovRuslan closed 6 years ago
I have a table which creates like:
create_table = [sql| CREATE TABLE IF NOT EXISTS sometable ( ... , time TIMESTAMP WITH TIME ZONE NOT NULL ... ); |]
Then I create someschema from sometable. Field time goes via psql functions: tstzrange, MAX and time_bucket(tsdb)
someschema
sometable
time
tstzrange
MAX
time_bucket
Then I have a query to this table:
data <- query conn Sql.selectFromSomeSchema (timeZoneName $ zonedTimeZone from, ...)
Sql query looks like:
selectFromSomeSchema = [sql| SELECT timezone(?, LOWER(range)) , timezone(?, UPPER(range)) , CAST(EXTRACT(EPOCH FROM (UPPER(range) - LOWER(range))) AS INTEGER) FROM someschema WHERE ... |]
And I have an error:
"Incompatible {errSQLType = \"timestamp\", errSQLTableOid = Nothing, errSQLField = \"timezone\", errHaskellType = \"ZonedTime\", errMessage = \"\"}"
Timestamptz does not store the timezone on a per-value or per-column basis. You should read the documentation I wrote in the Time module.
Time
Also, you might be interested in reading the discussion of issue #69.
I have a table which creates like:
Then I create
someschema
fromsometable
. Fieldtime
goes via psql functions:tstzrange
,MAX
andtime_bucket
(tsdb)Then I have a query to this table:
Sql query looks like:
And I have an error: