Skip to content

Error 500 on /watchers & /stars #2176

Closed

Description

@LeKovr

I open project page and click to watcher or start counter. This gives me error 500 (both org/repo/watchers and org/repo/stars)
in logs:

...routers/repo/view.go:262 renderItems()] [E] getter: pq: syntax error at or near "."

Gogs v0.7.33
DB: Postgresql 9.3.10

Activity

  1. LeKovr commented on Dec 13, 2015

    @LeKovr
    Author

    The same error in Gogs v 0.8.0.1212

  2. unknwon commented on Dec 13, 2015

    @unknwon
    Member

    Thanks your feedback!

    Can you dump the xorm.log here as well?

  3. added
    💊 bug
    status: needs feedback
    on Dec 13, 2015
  4. added this to the 0.9.0 milestone on Dec 13, 2015
  5. LeKovr commented on Dec 13, 2015

    @LeKovr
    Author

    For this gogs.log record:

    2015/12/14 01:34:13 [...routers/repo/view.go:260 renderItems()] [E] getter: pq: syntax error at or near "."
    

    attached xorm.log.txt

  6. unknwon commented on Dec 13, 2015

    @unknwon
    Member

    Thanks!

    Is this a valid SQL query in PostgreSQL?

    SELECT * FROM "user" LEFT JOIN "watch" ON user.id=watch.user_id WHERE repo_id=1
    

    If not, can you help debug which part is exactly wrong? The error from pg is so disappointing...

  7. LeKovr commented on Dec 13, 2015

    @LeKovr
    Author

    No, this is invalid SQL.
    You should use this

    SELECT * FROM "user"  LEFT JOIN "watch" ON "user".id=watch.user_id WHERE repo_id=1;
    

    or even

    SELECT * FROM "user" u LEFT JOIN "watch" ON u.id=watch.user_id WHERE repo_id=1;
    
  8. unknwon commented on Dec 13, 2015

    @unknwon
    Member

    Thanks, the user is the problem I'm thinking.

    Does

    SELECT * FROM "user"  LEFT JOIN "watch" ON `user`.id=watch.user_id WHERE repo_id=1;
    

    would work?

  9. LeKovr commented on Dec 14, 2015

    @LeKovr
    Author

    Nope, only double quotes allowed. And user must be doublequoted - it is keyword

  10. added a commit that references this issue on Dec 14, 2015
  11. unknwon commented on Dec 14, 2015

    @unknwon
    Member

    Hi, can you checkout develop branch and help test?

  12. LeKovr commented on Dec 14, 2015

    @LeKovr
    Author

    Yes I can)

  13. LeKovr commented on Dec 14, 2015

    @LeKovr
    Author

    Develop branch works fine. Thank you, Unknwon!

  14. unknwon commented on Dec 14, 2015

    @unknwon
    Member

    👏 Thanks your confirmation!

  15. removed
    status: needs feedback
    on Dec 14, 2015
  16. kolesar-andras commented on Dec 17, 2015

    @kolesar-andras

    I have got the same error 500, and the same message in xorm.log. Thank you for the fix.

  17. locked as resolved and limited conversation to collaborators on May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    💊 bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions