home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

3 rows where issue = 309558826 and "updated_at" is on date 2018-03-30 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • simonw 3

issue 1

  • Keyset pagination doesn't work correctly for compound primary keys · 3 ✖

author_association 1

  • OWNER 3
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
377457214 https://github.com/simonw/datasette/issues/190#issuecomment-377457214 https://api.github.com/repos/simonw/datasette/issues/190 MDEyOklzc3VlQ29tbWVudDM3NzQ1NzIxNA== simonw 9599 2018-03-30T06:31:15Z 2018-03-30T06:31:15Z OWNER

Fixed! https://datasette-issue-190-compound-pks-second-fix.now.sh/compound-pks-8e99805/compound_three_primary_keys?_next=b%2Cx%2Cd&content__contains=d now correctly shows b,y,d as the first row on the page.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Keyset pagination doesn't work correctly for compound primary keys 309558826  
377457087 https://github.com/simonw/datasette/issues/190#issuecomment-377457087 https://api.github.com/repos/simonw/datasette/issues/190 MDEyOklzc3VlQ29tbWVudDM3NzQ1NzA4Nw== simonw 9599 2018-03-30T06:30:23Z 2018-03-30T06:30:23Z OWNER

Interestingly, in deploying a copy of the database to demonstrate this final bug fix I had to use the --force argument like so:

datasette publish now --branch=master compound-pks.db --force

This is because now had already deployed a Dockerfile referencing --branch=master once already, so it thought nothing had changed and it could re-use that last deployment.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Keyset pagination doesn't work correctly for compound primary keys 309558826  
377454591 https://github.com/simonw/datasette/issues/190#issuecomment-377454591 https://api.github.com/repos/simonw/datasette/issues/190 MDEyOklzc3VlQ29tbWVudDM3NzQ1NDU5MQ== simonw 9599 2018-03-30T06:11:59Z 2018-03-30T06:11:59Z OWNER

Re-opening this issue: my fix doesn't play nicely with extra filter arguments.

Consider this page: https://datasette-issue-190-compound-pks-not-quite-fixed.now.sh/compound-pks-8e99805/compound_three_primary_keys?content__contains=d

The next link is to ?_next=f%2Cz%2Ct&content__contains=z (that's next of f,z,t) but that gives us https://datasette-issue-190-compound-pks-not-quite-fixed.now.sh/compound-pks-8e99805/compound_three_primary_keys?_next=b%2Cx%2Cd&content__contains=d which shows a,a,d at the top.

Sure enough, the generated SQL looks like this: https://datasette-issue-190-compound-pks-not-quite-fixed.now.sh/compound-pks-8e99805?sql=select+%2A+from+compound_three_primary_keys+where+%22content%22+like+%3Ap0+and+%28%5Bpk1%5D+%3E+%3Ap0%29%0A++or%0A%28%5Bpk1%5D+%3D+%3Ap0+and+%5Bpk2%5D+%3E+%3Ap1%29%0A++or%0A%28%5Bpk1%5D+%3D+%3Ap0+and+%5Bpk2%5D+%3D+%3Ap1+and+%5Bpk3%5D+%3E+%3Ap2%29+order+by+pk1%2C+pk2%2C+pk3+limit+101&p0=%25d%25&p1=b&p2=x&p3=d

select * from compound_three_primary_keys where "content" like :p0 and ([pk1] > :p0)
  or
([pk1] = :p0 and [pk2] > :p1)
  or
([pk1] = :p0 and [pk2] = :p1 and [pk3] > :p2) order by pk1, pk2, pk3 limit 101

The parameters here are confused. The :p0 should be reserved just for the like clause - the other parameters should be p1, p2 and p3 (not p0, p1 and p2).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Keyset pagination doesn't work correctly for compound primary keys 309558826  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 22.513ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows