-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to