On Thu, August 3, 2006 22:50, Lumir Vanek wrote:

> I have simple query to PostgreSQL system catalog:
>
> SELECT reltuples  FROM pg_class
>
> and some tables have reltuples > 1 000 000. When I read resultset:
>
> long lEstimatedRows;
> m_pqxxResultTables[i]["reltuples"].to(lEstimatedRows);
>
> I get exception:
> Error reading field reltuples: Unexpected text after integer:
> '1.0536e+006'

You're converting a "real" (which is a floating-point type) to a "long"
(which of course is an integral type).  The conversion function tries to
parse it as an integer, and finds that it doesn't look like one.

Solution: make lEstimatedRows a double instead of a long.  It just goes to
show how bad an idea it really is to embody a variable's type in its name.
 :-)


Jeroen


_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to