[web2py] .last() don't return last table id and first() also not returning the first record id

26 views
Skip to first unread message

Richard

unread,
Sep 9, 2015, 1:33:57 PM9/9/15
to web2py-users
Hello,

db().select(db.table.id).last().id don't return the last record available, it consistently (same id) return a wrong record id... 

rows[-1] also return wront (the same id)

.first() also not return the first available record

rows[0] also return wrong (the same id)

Is that normal?

Richard

Leonel Câmara

unread,
Sep 9, 2015, 2:23:01 PM9/9/15
to web2py-users
You do not have an orderby on that select so, depending on your backend, yes that can be very normal.

Richard Vézina

unread,
Sep 9, 2015, 2:55:07 PM9/9/15
to web2py-users
Postgres

On Wed, Sep 9, 2015 at 2:23 PM, Leonel Câmara <leonel...@gmail.com> wrote:
You do not have an orderby on that select so, depending on your backend, yes that can be very normal.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michele Comitini

unread,
Sep 9, 2015, 3:06:54 PM9/9/15
to web...@googlegroups.com
absolutely normal, try ordering or using max

Richard Vézina

unread,
Sep 9, 2015, 3:14:06 PM9/9/15
to web2py-users
Ok you right... orderby=id
Reply all
Reply to author
Forward
0 new messages