sqlite select max() on integer field returns quoted value

Tertius tertiusc at netscape.net
Thu Jun 19 23:49:02 CEST 2003

Thanks Graham...It does work yes.
Also for the explanation of the "max() type". I just presumed that the 
type of the column in question would be returned.
Guess i'll have to pay more attention to sqlite *types* :)


Graham Fawcett wrote:
> Does this work?
> cnx = connect('db')
> c = cnx.cursor()
> c.execute('-- types int')
> c.execute('select max(id) from table')
> Check out:
> http://pysqlite.sourceforge.net/documentation/pysqlite/node10.html
> "SQLite is typeless. It stores all data as text. However, all data
> returned from PySQLite are cast into their respective Python types as
> declared in the database schema, provided that said types are standard
> ANSI SQL type (e.g. VARCHAR, INT, FLOAT, etc.)."
> Based on this, my guess is that PySQLite is having trouble figuring
> out what the type of a max() result ought to be, since max is not in
> your schema (of course).
> -- Graham

More information about the Python-list mailing list