ok then post a bug so it doesn't get lost. PS: I remember asking for the same thing and patching DAL, but it was for empty lists indeed.
Il giorno martedì 6 novembre 2012 17:27:04 UTC+1, Marin Pranjić ha scritto: > > I tried this: > db(db.auth_user.id.belongs())._select(db.auth_user.id) > > And it prints: > 'SELECT auth_user.id FROM auth_user WHERE (1=0);' > > > So, it works as expected. > My question is invalid because I have something else in code: > > > db.tablename.fieldname.belongs(set()) > > Which is not working: > > 'SELECT auth_user.id FROM auth_user WHERE (auth_user.id IN ());' > > > So the issue is with set, not a list. > Sorry :) > > > Dana utorak, 6. studenoga 2012. 17:10:33 UTC+1, korisnik Niphlod napisao > je: >> >> uhm. >> elif second==[] or second==(): >> return '(1=0)' >> why this is not reached ? >> >> what is printed when you use >> db(db.tablename.fieldname.belongs([]))._select() ? >> >> Il giorno martedì 6 novembre 2012 17:01:08 UTC+1, Marin Pranjić ha >> scritto: >>> >>> The issue is that SQLite allows to do: >>> something = [] >>> db(db.tablename.fieldname.belongs(something)).select() >>> >>> However this fails on postgres (not sure what about the others). >>> >>> I am using SQLite for development so I don't notice the error until I >>> move the code into production. >>> Not only I have error tickets in production (which should not happen), >>> my code ends up with lots of if-else lines and I don't like it either. >>> >>> I think DAL should be smarter. Now it passes a query to db and postgres >>> raises a syntax error. >>> What do you think? >>> >>> >>> --

