On Fri, Jul 9, 2021 at 3:13 AM Silviu Panaite <[email protected]>
wrote:

> Hi all,
>
> I am having issues with PG adapter and Sequel::Model.plugin :timestamps...
> when I try to save an db object I get:
>
> Sequel::DatabaseError (PG::SyntaxError: ERROR:  error in argument for $1:
> could not parse string "'2021-07-09 10:09:54.591896+0000'" as timestamptz)
>
> How would one debug such an issue?
>

This issue definitely comes from the database server's parsing, not
Sequel's parsing.  You can tell because it raises PG::SyntaxError.

I can't reproduce this issue, either with or without bound variables:

s = '2021-07-09 10:09:54.591896+0000'
# => "2021-07-09 10:09:54.591896+0000"
DB.get(Sequel.cast(s, :timestamptz))
# SELECT CAST('2021-07-09 10:09:54.591896+0000' AS timestamptz) AS "v"
LIMIT 1
=> 2021-07-09 03:09:54.591896 -0700
ps = DB.select(Sequel.cast(:$n, :timestamptz)).prepare(:single_value,
:get_tstz)
ps.call(:n=>s)
# PREPARE get_tstz AS SELECT CAST($1 AS timestamptz) LIMIT 1
# EXECUTE get_tstz; ["2021-07-09 10:09:54.591896+0000"]
=> 2021-07-09 03:09:54.591896 -0700

I also tried surrounding the timestamp value in single quotes, with the
same results.

Can you put together a self contained example showing this problem?

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CADGZSSc1qo6r%3DtJOWmM4MRadONPtrC0Mrz2_MOonN4JHu9%2Bs_A%40mail.gmail.com.

Reply via email to