Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to search links tagged in one tag #320

Open
krylm opened this issue Oct 8, 2021 · 8 comments
Open

Unable to search links tagged in one tag #320

krylm opened this issue Oct 8, 2021 · 8 comments
Labels
Bug Something isn't working

Comments

@krylm
Copy link

krylm commented Oct 8, 2021

Describe the bug
When I use searching, fill one tag label to list all links. I get 502 Bad Gateway error and no response.

To Reproduce
Steps to reproduce the behavior:

  1. Go to search (top right corner)
  2. Type into Tag(s) input field one tag
  3. Click Search
  4. Error 502 Bad Gateway

LinkAce setup (please complete the following information):

  • Version: 1.6.4
  • Installed via: Docker, sqlite database
  • OS: Debian

Additional context
I am getting this error in System logs view:

SQLSTATE[22001]: String data, right truncated: 18 string or blob too big (SQL: select count(*) as aggregate from "links" where "user_id" = 1 and exists (select * from "tags" inner join "link_tags" on "tags"."id" = "link_tags"."tag_id" where "links"."id" = "link_tags"."link_id" and "name" in (knihy) and "tags"."deleted_at" is null order by "name" asc) and "links"."deleted_at" is null) {"userId":1,"exception":"[object] (Illuminate\\Database\\QueryException(code: 22001): SQLSTATE[22001]: String data, right truncated: 18 string or blob too big (SQL: select count(*) as aggregate from \"links\" where \"user_id\" = 1 and exists (select * from \"tags\" inner join \"link_tags\" on \"tags\".\"id\" = \"link_tags\".\"tag_id\" where \"links\".\"id\" = \"link_tags\".\"link_id\" and \"name\" in (knihy) and \"tags\".\"deleted_at\" is null order by \"name\" asc) and \"links\".\"deleted_at\" is null) at /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php:692)

There is 163 links tagged as this "knihy" tag and I have 3743 total tags and 9847 total links in database.

@krylm krylm added the Bug Something isn't working label Oct 8, 2021
@Kovah
Copy link
Owner

Kovah commented Oct 8, 2021

I actually have no idea what the hell this is. The search is working fine in both 1.6.4 and 1.7.0.

String data, right truncated: 18 string or blob too big

Is it possible that one of the tags has an extremely long name? Theoretically, tag names could be thousands of characters long. is there a tag that is too long, maybe? Could also be related to sqlite.

@krylm
Copy link
Author

krylm commented Oct 8, 2021

I've exported all tags, attaching them here. If I am right, maximal number of characters is 35 (tag: hierarchical reinforcement learning).

all-tags.csv

@Kovah
Copy link
Owner

Kovah commented Oct 13, 2021

I am sorry but I have no idea what the issue might be. If you don't have any confidential links in your database, feel free to send me the database dump (via email, not here) and I can have a deeper look.

@krylm
Copy link
Author

krylm commented Oct 13, 2021

Email sent. Thank you!

@Kovah
Copy link
Owner

Kovah commented Nov 2, 2021

I have tested your dump with SQLite and MariaDB and the search for the tag you mentioned worked without issues. :/
Could you try to dump your database, delete the SQLite database file and restore the dump with a fresh file?
https://www.prisma.io/dataguide/sqlite/importing-and-exporting-data-in-sqlite

@krylm
Copy link
Author

krylm commented Nov 2, 2021

Thank you for your try. I will do it and let you know.

@krylm
Copy link
Author

krylm commented Nov 13, 2021

I dumped database and restored it to new file. But without any change.

I've tried run SQL query from error log directly via sqlite3 command:
select count(*) as aggregate from "links" where "user_id" = 1 and exists (select * from "tags" inner join "link_tags" on "tags"."id" = "link_tags"."tag_id" where "links"."id" = "link_tags"."link_id" and "name" in (knihy) and "tags"."deleted_at" is null order by "name" asc) and "links"."deleted_at" is null

and got error
Error: no such column: knihy

When I escaped word kiny with single quotes it runs without any erorr:
select count(*) as aggregate from "links" where "user_id" = 1 and exists (select * from "tags" inner join "link_tags" on "tags"."id" = "link_tags"."tag_id" where "links"."id" = "link_tags"."link_id" and "name" in ('knihy') and "tags"."deleted_at" is null order by "name" asc) and "links"."deleted_at" is null;

and I got 163 as response.

I am not sure how the query is constructed when logging, but it seems without quotes. And same in escaped output after that...

@Kovah
Copy link
Owner

Kovah commented Dec 2, 2021

The tag should be quoted internally. It is possible that the logs omit the quotes around it.
I will keep this open for further investigation, as I still have no idea what's wrong. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants