sharry icon indicating copy to clipboard operation
sharry copied to clipboard

Shares not accessible after upgrade to 1.15.0

Open kqfflo opened this issue 9 months ago • 8 comments

HI there,

after upgrading my shares are not shown anymore. SQL query being the root cause it seems. Using 11.6.1-MariaDB

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 100' at line 1

Starting 1.14.0 against the same database works.

kqfflo avatar Mar 19 '25 12:03 kqfflo

Thank you @kqfflo . That is strange to me, I don't remember changing any SQL code 🤔 I need to take a look later 👍🏼

Edit: I just forgot, there was a related change of course. Could be this https://github.com/eikek/sharry/pull/1485

eikek avatar Mar 19 '25 13:03 eikek

This is the full query - might help a little better than only the generic error I shared before.

sharry.store.Store.run:39 - SQL failure: ExecFailure (SELECT s.id , s.account_id , s.alias_id , s.name_ , s.validity , s.max_views , s.password , s.description , s.created , p.enabled , p.publish_until , a.id , a.name_ , COALESCE( f.files , 0) , COALESCE( f.size , 0) FROM share s LEFT OUTER JOIN publish_share p ON p.share_id = s.id LEFT OUTER JOIN alias_ a ON a.id = s.alias_id LEFT OUTER JOIN ( SELECT r.share_id as fshare, COUNT( m.file_id ) as files, SUM( m.length ) as size FROM share_file r INNER JOIN filemeta m ON r.file_id = m.file_id GROUP BY fshare ) as f ON fshare = s.id WHERE ( ( s.account_id = ? OR s.alias_id IN ( SELECT alias_id FROM alias_member WHERE account_id = ? ) ) AND ( LOWER( s.name_ ) LIKE ? OR LOWER( s.id ) LIKE ? OR LOWER( a.name_ ) LIKE ? OR LOWER( s.description ) LIKE ? ) ) ORDER BY s.created DESC OFFSET ? LIMIT ? ,NonBatch(List(Ident(GuPmobDLqDT-a6fcPSQeESY-D5YwEiBt3u8-13HH5iRu68q), Ident(GuPmobDLqDT-a6fcPSQeESY-D5YwEiBt3u8-13HH5iRu68q), %%, %%, %%, %%, 0, 100)), unlabeled,1393557 nanoseconds,java.sql.SQLSyntaxErrorException: (conn=126590) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 100' at line 1)

kqfflo avatar Mar 20 '25 15:03 kqfflo

Thanks! Hm, I can't see anything obviously wrong from that query. It is the same MariaDB version, right?

eikek avatar Mar 21 '25 08:03 eikek

Ah I think it is the order of OFFSET and LIMIT :-( MariaDB wants LIMIT to appear before OFFSET or no OFFSET 0 at all.

eikek avatar Mar 21 '25 08:03 eikek

This makes a lot of sense and seems to be the root cause for this. https://mariadb.com/kb/en/limit/

kqfflo avatar Mar 23 '25 14:03 kqfflo

This also appears to be a problem when using a H2 database: org.h2.jdbc.JdbcSQLSyntaxErrorException

Syntax error in SQL statement \"SELECT s.id , s.account_id , s.alias_id , s.name_ , s.validity , s.max_views , s.password , s.description , s.created , p.enabled , p.publish_until , a.id , a.name_ , COALESCE( f.files , 0) , COALESCE( f.size , 0) FROM share s LEFT OUTER JOIN publish_share p ON p.share_id = s.id LEFT OUTER JOIN alias_ a ON a.id = s.alias_id LEFT OUTER JOIN ( SELECT r.share_id as fshare, COUNT( m.file_id ) as files, SUM( m.length ) as size FROM share_file r INNER JOIN filemeta m ON r.file_id = m.file_id GROUP BY fshare ) as f ON fshare = s.id WHERE ( ( s.account_id = ? OR s.alias_id IN ( SELECT alias_id FROM alias_member WHERE account_id = ? ) ) AND ( LOWER( s.name_ ) LIKE ? OR LOWER( s.id ) LIKE ? OR LOWER( a.name_ ) LIKE ? OR LOWER( s.description ) LIKE ? ) ) ORDER BY s.created DESC OFFSET ? [*]LIMIT ? \"; SQL statement:\nSELECT s.id , s.account_id , s.alias_id , s.name_ , s.validity , s.max_views , s.password , s.description , s.created , p.enabled , p.publish_until , a.id , a.name_ , COALESCE( f.files , 0) , COALESCE( f.size , 0) FROM share s LEFT OUTER JOIN publish_share p ON p.share_id = s.id LEFT OUTER JOIN alias_ a ON a.id = s.alias_id LEFT OUTER JOIN ( SELECT r.share_id as fshare, COUNT( m.file_id ) as files, SUM( m.length ) as size FROM share_file r INNER JOIN filemeta m ON r.file_id = m.file_id GROUP BY fshare ) as f ON fshare = s.id WHERE ( ( s.account_id = ? OR s.alias_id IN ( SELECT alias_id FROM alias_member WHERE account_id = ? ) ) AND ( LOWER( s.name_ ) LIKE ? OR LOWER( s.id ) LIKE ? OR LOWER( a.name_ ) LIKE ? OR LOWER( s.description ) LIKE ? ) ) ORDER BY s.created DESC OFFSET ? LIMIT ? [42000-232]

ChriFo avatar Apr 10 '25 09:04 ChriFo

Is there a new debian release? Thank you.

albertbern avatar Aug 27 '25 11:08 albertbern

I'm seeing the same issue w/ the H2 database. Can't list shares.

hikeeba avatar Oct 24 '25 22:10 hikeeba