[racket] making postgresql timestamp

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Sun May 5 22:03:21 EDT 2013

It looks like postgres is expecting an integer instead of a timestamp 
for that query parameter. Are you sure the corresponding field is 
declared as a timestamp? Make sure you've written things in the right order.

Ryan

On 05/05/2013 09:39 PM, Kejia柯嘉 wrote:
> 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.