Hi.
I have noted that with this query:
# query is the original query
# query_aux is the query required to compute the number of rows returned
# by the original query
query_aux = sql.select(
[sql.func.count()], from_obj=[query])
I get, with PostgreSQL 8.3.7 (and SQLALchemy from trunk):
ProgrammingError: (ProgrammingError) subquery in FROM must have an alias
HINT: For example, FROM (SELECT ...) [AS] foo
The solution is to explicitly add an alias
query_aux = sql.select(
[sql.func.count()], from_obj=[query.alias('subquery')])
However IMHO this should be done by SQLALchemy, and not by the programmer.
What do you think?
Thanks Manlio Perillo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkoByRkACgkQscQJ24LbaUQz8QCeIrSG2o+XeiZEi1PUY7RmbGG3
148An39JLOw/KRnffUcKknmF8aQQnZmh
=hiSI
-----END PGP SIGNATURE-----