mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fixed bug where tables with a column called n caused 500 errors
Closes #1228
This commit is contained in:
parent
32963018e7
commit
4e47a2d894
7 changed files with 59 additions and 37 deletions
|
|
@ -151,10 +151,10 @@ class ColumnFacet(Facet):
|
|||
if column in already_enabled:
|
||||
continue
|
||||
suggested_facet_sql = """
|
||||
select {column}, count(*) as n from (
|
||||
select {column} as value, count(*) as n from (
|
||||
{sql}
|
||||
) where {column} is not null
|
||||
group by {column}
|
||||
) where value is not null
|
||||
group by value
|
||||
limit {limit}
|
||||
""".format(
|
||||
column=escape_sqlite(column), sql=self.sql, limit=facet_size + 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue