Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: Cannot get date fields to import from PostgreSQL via ODBC

From   Dave Ewart <>
Subject   Re: st: Re: Cannot get date fields to import from PostgreSQL via ODBC
Date   Wed, 28 Sep 2005 16:12:42 +0100

Hash: SHA1

On Wednesday, 28.09.2005 at 09:43 -0500, Kevin Crow - StataCorp wrote:

> I am not able to reproduce the bug here, but it does look like a bug
> because you where able to query the database using the -iodbc- client
> and get the correct results from the  PostgreSQL driver.  Do you know
> what version of the PostgreSQL driver you are using?

I'm using odbc-postgresql 07.03.0200-5 on a Debian AMD64 system.  This
driver has a slightly chequered history on AMD64 (see my Debian bug
report at , but
it wasn't until I found that dates from MySQL imported OK that I
suspected it to be to blame for this one too!  

I am going to try building a recent odbc-postgresql,
psqlodbc-08.00.0102, but the dependencies for that are more recent
versions of ODBC libraries etc., which makes it non-trivial.

I will try this, because it would be good (if possible) to put this bug
down to a bug in odbc-postgresql rather than Stata.

> > So, at the 'describe' stage, Stata is perfectly aware of the correct
> > data
> >types for each field.
> Also, when you use the -odbc exec- command Stata is simply displaying
> information giving to it as a string by the odbc driver.  Stata is not
> "aware" of the time/date data types of PostgreSQL.

Well, I disagree slightly: when you -odbc load-, the format given to the
date variable is %td, which at least infers that Stata believes it to be
a date!

I will post back my findings relating to the odbc-postgresql driver, if
only to feed the archives ... :-)


- -- 
Dave Ewart
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from
N 51.7518, W 1.2016
Version: GnuPG v1.2.4 (GNU/Linux)

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index