Actually I am not sure why the SQL is wrong. The SQL looks correct
although with_alias for a field is undocumented, except for tables,
and I am not sure how well it works.

On Jan 10, 3:42 pm, LightOfMooN <[email protected]> wrote:
> rolics = db(db.rolic.id>0).select(db.rolic.id.with_alias('myid'))
>
> Traceback (most recent call last):
>   File "/home/www-data/web2py/gluon/contrib/shell.py", line 225, in
> run
>     exec compiled in statement_module.__dict__
>   File "<string>", line 1, in <module>
>   File "/home/www-data/web2py/gluon/dal.py", line 4507, in select
>     return self.db._adapter.select(self.query,fields,attributes)
>   File "/home/www-data/web2py/gluon/dal.py", line 1003, in select
>     rows = response(sql)
>   File "/home/www-data/web2py/gluon/dal.py", line 994, in response
>     self.execute(sql)
>   File "/home/www-data/web2py/gluon/dal.py", line 1067, in execute
>     return self.log_execute(*a, **b)
>   File "/home/www-data/web2py/gluon/dal.py", line 1064, in log_execute
>     return self.cursor.execute(*a,**b)
> ProgrammingError: syntax error at or near "AS"
> LINE 1: SELECT  (rolic.id AS myid) FROM rolic WHERE (rolic.id > 0);
>                                       ^
>
> What's wrong? Help, please.

Reply via email to