Re: timestamp and mxDateTime

Michael Hipp <[email protected]> Wed, 29 Sep 2004 08:11:57 -0500
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
Karsten Hilbert wrote:

>>--------------------------
>>from   pyPgSQL import PgSQL
>>from   mx.DateTime import *
>>
>>db = PgSQL.connect(dsn="localhost", database="test")
>>cursor = db.cursor()
>>
>>rightnow = now()
>>cursor.execute("insert into dailylog values (%s)", rightnow)
>>--------------------------
>>
>>That column in PostgreSQL was defined as a 'timestamp' type.
> 
> Erm, *which* column ? You certainly don't say in your insert
> query. Likely you are thinking it inserts into one column
> while it actually does insert into another.
> 
> 
>>libpq.OperationalError: ERROR:  value too long for type character varying(4)
> 
> Look out for varchar(4) columns in your table.

There is only one column in that table as it is a "test" for the 
timestamp type since that is what is giving me trouble. Here is the SQL 
that created it:

CREATE TABLE dailylog (
    enttime        timestamp     -- time entered by the operator
);

Which is why the error about "varchar(4)" is puzzling since I have none.

Thank you,
Michael



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl