mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fixed #216 - paginate correctly when sorting by nullable column
This commit is contained in:
parent
1652a9707e
commit
2abe539a0f
3 changed files with 60 additions and 14 deletions
|
|
@ -55,6 +55,7 @@ def generate_sortable_rows(num):
|
|||
'sortable_with_nulls_2': rand.choice([
|
||||
None, rand.random(), rand.random()
|
||||
]),
|
||||
'text': rand.choice(['$null', '$blah']),
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -78,6 +79,7 @@ METADATA = {
|
|||
'sortable',
|
||||
'sortable_with_nulls',
|
||||
'sortable_with_nulls_2',
|
||||
'text',
|
||||
]
|
||||
},
|
||||
'no_primary_key': {
|
||||
|
|
@ -153,6 +155,7 @@ CREATE TABLE sortable (
|
|||
sortable integer,
|
||||
sortable_with_nulls real,
|
||||
sortable_with_nulls_2 real,
|
||||
text text,
|
||||
PRIMARY KEY (pk1, pk2)
|
||||
);
|
||||
|
||||
|
|
@ -235,7 +238,7 @@ CREATE VIEW simple_view AS
|
|||
]) + '\n'.join([
|
||||
'''INSERT INTO sortable VALUES (
|
||||
"{pk1}", "{pk2}", "{content}", {sortable},
|
||||
{sortable_with_nulls}, {sortable_with_nulls_2});
|
||||
{sortable_with_nulls}, {sortable_with_nulls_2}, "{text}");
|
||||
'''.format(
|
||||
**row
|
||||
).replace('None', 'null') for row in generate_sortable_rows(201)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue