YunoHost-Apps / mautrix_signal_ynh

Matrix signal package for YunoHost
GNU Affero General Public License v3.0
4 stars 10 forks source link

Database issues when restoring/removing #55

Open MayeulC opened 2 years ago

MayeulC commented 2 years ago

Remove:

2022-08-31 16:30:39,193: WARNING - ERREUR:  erreur de syntaxe sur ou près de « @ »
2022-08-31 16:30:39,193: WARNING - LIGNE 1 : DROP OWNED BY @signalbot:tld.com;

Restore:

Info : [#####++++++++++.....] > Restoring the PostgreSQL database...
Attention : ERREUR:  erreur de syntaxe sur ou près de « WITH »
Attention : LIGNE 1 : CREATE USER  WITH ENCRYPTED PASSWORD 'xxxxxx...
Attention :                        ^
Attention : ERREUR:  erreur de syntaxe sur ou près de « ; »
Attention : LIGNE 1 : CREATE DATABASE ;
Attention :                           ^
MayeulC commented 1 year ago

I really think these lines are useless and don't do anything:

@yalh76, can you comment why you added them in https://github.com/YunoHost-Apps/mautrix_signal_ynh/commit/b2c96f360b3c0cca9ea24b40e614a2bdb1ffeb39 ?

https://github.com/YunoHost-Apps/mautrix_signal_ynh/blob/43ff5e302a734abf1b191845c4685c20ea3d6227/scripts/remove#L69-L74

There is only one user in the db, it's mautrix_signal. On my system:

matrix_synapse=# SELECT rolname FROM pg_roles;
          rolname          
---------------------------
 pg_monitor
 pg_read_all_settings
 pg_read_all_stats
 pg_stat_scan_tables
 pg_read_server_files
 pg_write_server_files
 pg_execute_server_program
 pg_signal_backend
 invidious
 matrix_synapse
 mautrix_signal
 onlyoffice
 postgres
(13 lignes)

If you want to DROP OWNED BY mautrix_signal, this has to be performed before deleting the role, so the two lines before are useless as well. Moreover, I double-checked that mautrix_signal only owns tables in the mautrix_signal db.

Error log output in CI or when removing:

14025 WARNING ERROR:  role "mautrix_signal" does not exist
14571 WARNING ERROR:  role "mautrix_signal" does not exist
15123 WARNING ERROR:  syntax error at or near "@"
15124 WARNING LINE 1: DROP OWNED BY @signalbot:domain.tld;
15125 WARNING                       ^
15668 WARNING ERROR:  syntax error at or near "@"
15669 WARNING LINE 1: DROP USER @signalbot:domain.tld;
15670 WARNING                   ^
16228 WARNING ERROR:  role "signalbot" does not exist
16794 WARNING ERROR:  role "signalbot" does not exist
17347 WARNING ERROR:  role "signald" does not exist
17911 WARNING ERROR:  role "signald" does not exist

I suggest reverting b2c96f360b3c0cca9ea24b40e614a2bdb1ffeb39. What was even the idea behind? To purge all messages from the bot, and portal rooms? I am not sure if that's desirable, but that surely doesn't have anything to do with psql's role system.

yalh76 commented 1 year ago

I really think these lines are useless and don't do anything:

@yalh76, can you comment why you added them in b2c96f3 ?

They come from https://github.com/YunoHost-Apps/mautrix_whatsapp_ynh/blob/aa421e61f99f25a1f373bcb54b986f9c00416579/scripts/remove#L63-L71

There was no reason for one mautrix_*_ynh needed it and not the other ones, I didn't dig down into it, just copy/pasted

MayeulC commented 1 year ago

Well, mautrix_whatsapp uses the Go mautrix library, while telegram, signal and facebook use the python one. I may dig a bit more, but I think we might as well remove these lines.

yalh76 commented 1 year ago

Well, mautrix_whatsapp uses the Go mautrix library, while telegram, signal and facebook use the python one. I may dig a bit more, but I think we might as well remove these lines.

Feel free to do then ;)