Skip to content

Commit 345d4ad

Browse files
committed
Modify sql syntax for pgsql
1 parent bf01510 commit 345d4ad

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

server/repo-mgr.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3583,13 +3583,24 @@ gint64
35833583
seaf_get_total_storage (GError **error)
35843584
{
35853585
gint64 size = 0;
3586-
int ret = seaf_db_statement_foreach_row (seaf->db,
3586+
int ret;
3587+
if (seaf_db_type(seaf->db) == SEAF_DB_TYPE_PGSQL) {
3588+
ret = seaf_db_statement_foreach_row (seaf->db,
3589+
"SELECT \"size\" FROM RepoSize s "
3590+
"LEFT JOIN VirtualRepo v "
3591+
"ON s.repo_id=v.repo_id "
3592+
"WHERE v.repo_id IS NULL",
3593+
get_total_storage_cb,
3594+
&size, 0);
3595+
} else {
3596+
ret = seaf_db_statement_foreach_row (seaf->db,
35873597
"SELECT size FROM RepoSize s "
35883598
"LEFT JOIN VirtualRepo v "
35893599
"ON s.repo_id=v.repo_id "
35903600
"WHERE v.repo_id IS NULL",
35913601
get_total_storage_cb,
35923602
&size, 0);
3603+
}
35933604
if (ret < 0) {
35943605
seaf_warning ("Failed to get total storage occupation.\n");
35953606
g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_GENERAL,

0 commit comments

Comments
 (0)