[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Dates, postgresql and pygresql



Johann Spies wrote:
  >When I want to write a date to a postgres table in the following query
  >(using python and pygresql)
  >
  >INSERT INTO lidmate VALUES (3157,864,'ACKERMAN','MARTHINUS THEODORUS','MNR',
  >	'','ACKERMAN','','O','M','B','','','17/06/1997','19/08/1997')
  >
  >the following error message occurs:
  >
  >Traceback (innermost last):
  >  File "<stdin>", line 78, in ?
  >  File "<stdin>", line 71, in skryf_data
  >ValueError: WARN:Bad date external representation 
  >
  >I have the following lines in my .bashrc to set the locale:
  >
  >LANG='en_GB'
  >export LANG
  >
  >I also did a 
  >
  >os.system("set DateStyle to 'SQL,European'")
  >
  >in the program to see if that will solve the problem, but it made no
  >difference.
 
The message you are getting appears to be a PostgreSQL message, but the
syntax you are using works OK in psql.  Is it possible that Python is
mangling the data being sent to the backend? Can you run a debugger to
check what is happening?

Try running the postmaster in the foreground and have the backend echo 
queries, to check what requests the backend is seeing.

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver

PGP key from public servers; key ID 32B8FAA1



--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: