[racket] making postgresql timestamp

From: Kejia柯嘉 (w.kejia at gmail.com)
Date: Sun May 5 21:39:53 EDT 2013

Hi Ryan,

Thanks a lot for your reply.

How should I `insert into' a timestamp field in postgres? When I apply
a sql-timestamp to query-exec, I got exceptions:
``
query-exec: cannot convert given value to SQL type
  given: (sql-timestamp 2013 5 5 21 56 22 480000000 #f)
  type: int2
  expected: int16?
  dialect: PostgreSQL
''
--------------
Daniel


☵☯☲



2013/5/5 Ryan Culpepper <ryanc at ccs.neu.edu>:
> On 05/04/2013 01:22 PM, Kejia柯嘉 wrote:
>>
>> Hi,
>>
>> How should I construct a postgresql timestamp in terms of current time?
>>
>> Thanks.
>
>
> On the Racket side:
>
>   (require db db/util/datetime (prefix-in srfi: srfi/19))
>   (srfi-date->sql-timestamp-tz (srfi:current-date))
>
> On the server side:
>
>   (define c (postgresql-connect ___))
>   (query-value c "select now()")
>
> Ryan
>


Posted on the users mailing list.