Skip to content

select(distinct=...) may produce faulty sql for sqlite #316

@cassiobotaro

Description

@cassiobotaro

This one works:

In [45]: db().select(db.player.country, distinct = True)
Out[45]: <Rows (40)>

In [46]: db._lastsql
Out[46]: 'SELECT DISTINCT player.country FROM player;'

But the other option given in the book does not:

In [47]: db().select(db.player.country, distinct = db.player.country)
OperationalError: near "ON": syntax error

In [48]: db._lastsql
Out[48]: 'SELECT DISTINCT ON (player.country) player.country FROM player;'

I didn't test it with other DB engines since I don't currently have one installed.

Related to web2py/web2py#1129

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions