[GRASS-dev] timestamp problems with PG driver

Markus Neteler neteler at osgeo.org
Mon Jul 19 09:25:03 EDT 2010


Hi,

I am connected to a PostgreSQL database with a timestamp column.
While column type connection etc works there is a problem with the
leading "0".

The original timestamp
2010-03-26 05:31:25
is printed by v.db.select as
2010-3-26 5:31:25

Below an excerpt of debug output:

D3/3: row = 99 nrows = 100
D3/3: row 99, col 0, gpgtype 8, sqltype 6: val = '38.1958365'
D3/3: row 99, col 1, gpgtype 8, sqltype 6: val = '15.9744719'
D3/3: row 99, col 2, gpgtype 3, sqltype 3: val = '976451'
D3/3: row 99, col 9, gpgtype 16, sqltype 11: val = '2010-03-26
05:31:25'  <<--- correctly fetched by PG driver
D3/3: Row fetched
D0/3: sqltype: 6
D0/3: Fetched valuestring: 38.1958365
D0/3: sqltype: 6
D0/3: Fetched valuestring: 15.9744719
D0/3: sqltype: 3
D0/3: Fetched valuestring: 976451
D0/3: sqltype: 6
D0/3: Fetched valuestring:
D0/3: sqltype: 3
D0/3: Fetched valuestring:
D0/3: sqltype: 3
D0/3: Fetched valuestring:
D0/3: sqltype: 6
D0/3: Fetched valuestring:
D0/3: sqltype: 3
D0/3: Fetched valuestring:
D0/3: sqltype: 3
D0/3: Fetched valuestring:
D0/3: sqltype: 11
D0/3: Fetched valuestring: 2010-3-26 5:31:25    <---
db_convert_column_value_to_string() failed
38.1958365|15.9744719|976451|||||||2010-3-26 5:31:25

As far as I understand, the formatting is getting lost in

lib/db/dbmi_base/columnfmt.c
db_convert_column_value_to_string()

which calls
db_get_column_value()

Is a kind of internal string conversion needed to maintain the leading "0"?
No clue...

thanks
Markus


More information about the grass-dev mailing list