[GRASS-dev] Misleading help of v.db.add*

Huidae Cho grass4u at gmail.com
Fri Jun 27 17:38:14 EDT 2008


Moritz,

I did some research about SQL2003-compliant data types and found the
SQL2003 specification (http://savage.net.au/SQL/sql-2003-2.bnf.html).
According to the specification, VARCHAR, INT, DOUBLE PRECISION, and DATE
are standard data types, and "MySQL treats DOUBLE as a synonym for
DOUBLE PRECISION (a non-standard extension)"
(http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html).  Since the
built-in SQL parser supports "DOUBLE PRECISION", the dbf backend has no
problem with this data type.  SQLite is also fine because it's typeless.
However, PostgreSQL does not recognize "DOUBLE", so I suggest to adapt
the help message.

What do you think?

Huidae


On Thu, May 29, 2008 at 11:11:10PM +0200, Moritz Lennert wrote:
> On 29/05/08 09:25, Huidae Cho wrote:
> >Hi,
> >I just tried to add a column to an existing attribute table in
> >PostgreSQL and found a misleading help message.  The help message of
> >v.db.addcol/v.db.addtable says "types depend on database backend, but
> >all support VARCHAR(), INT, DOUBLE and DATE".  I'm not so sure if the
> >postgres driver in GRASS supports the DOUBLE type internally.   However,
> >since v.db.add* scripts directly run db.execute which calls
> >db_driver_execute_immediate(), and PostgreSQL only supports DOUBLE
> >PRECISION and REAL for floating-point numbers, the help message is not
> >valid at least for PostgreSQL.
> >If those three data types are supposed to be common data types for all
> >database backends, v.db.add* scripts need to convert DOUBLE to a
> >corresponding valid data type based on the database backend.  Otherwise,
> >IMO, the help message needs to be revised to avoid confusion.
> 
> I am the culprit of this formulation. I agree that it should be adapted, but 
> someone would have to check which common types are available across all 
> backends...
> 
> Moritz


More information about the grass-dev mailing list