Re: psycopg, datetime timestamps and intervals
"Matthew Dennis" <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
In that example you're passing a text type, not a timestamp. The equivalent in psql would be something like current_timestamp or timestamp '2008-04-19 03:17:19.981575' or '2008-04-19 03:17:19.981575'::timestamp - something where the object is a timestamp type. I assuming that psycopg is sending bind variables to Postgres over the wire and not just doing string substitution/formatting on the query string... On Fri, Apr 18, 2008 at 10:19 PM, Nathan <[email protected]> wrote: > On Fri, Apr 18, 2008 at 8:33 PM, Matthew Dennis <[email protected]> > wrote: > > Running the equivalent in psql gives no problems, perhaps it's only a > > problem when using bind variables? > > Hmm. Are you sure? It sure gives me problems. > > >>> str(datetime.datetime.utcnow()) > '2008-04-19 03:17:19.981575' > > postgres=# select '2008-04-19 03:17:19.981575' - interval '1 hour'; > ERROR: invalid input syntax for type interval: "2008-04-19 > 03:17:19.981575" > > ~ Nathan > _______________________________________________ Psycopg mailing list Psycopg-IAPFreCvJWPBWskQ1e/[email protected] http://lists.initd.org/mailman/listinfo/psycopg