summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2025-06-03 14:43:47 +0100
committerGreg Roach <greg@subaqua.co.uk>2025-06-03 14:49:15 +0100
commit2937b888ded69ddbe497cdd34d86a7c39f92bb47 (patch)
tree8d9b43cdc6f3e90bd9cefda41321e9eec2c96649
parent01b87a5218be293b777eeab52bc75bfc8fab6e18 (diff)
downloadwebtrees-2937b888ded69ddbe497cdd34d86a7c39f92bb47.tar.gz
webtrees-2937b888ded69ddbe497cdd34d86a7c39f92bb47.tar.bz2
webtrees-2937b888ded69ddbe497cdd34d86a7c39f92bb47.zip
Fix: Postgres driver requires alias for aggregate columns
-rw-r--r--app/Http/RequestHandlers/ControlPanel.php16
-rw-r--r--resources/views/lists/locations-table.phtml4
-rw-r--r--resources/views/lists/media-table.phtml6
-rw-r--r--resources/views/lists/notes-table.phtml8
-rw-r--r--resources/views/lists/repositories-table.phtml2
-rw-r--r--resources/views/lists/sources-table.phtml8
-rw-r--r--resources/views/lists/submitters-table.phtml4
7 files changed, 24 insertions, 24 deletions
diff --git a/app/Http/RequestHandlers/ControlPanel.php b/app/Http/RequestHandlers/ControlPanel.php
index fa06a36979..958527c384 100644
--- a/app/Http/RequestHandlers/ControlPanel.php
+++ b/app/Http/RequestHandlers/ControlPanel.php
@@ -234,7 +234,7 @@ class ControlPanel implements RequestHandlerInterface
->where('change.status', '=', 'pending');
})
->groupBy(['gedcom.gedcom_id'])
- ->pluck(new Expression('COUNT(change_id)'), 'gedcom.gedcom_id')
+ ->pluck(new Expression('COUNT(change_id) AS total'), 'gedcom.gedcom_id')
->map(static fn (string $count): int => (int) $count)
->all();
}
@@ -249,7 +249,7 @@ class ControlPanel implements RequestHandlerInterface
return DB::table('gedcom')
->leftJoin('individuals', 'i_file', '=', 'gedcom_id')
->groupBy(['gedcom_id'])
- ->pluck(new Expression('COUNT(i_id)'), 'gedcom_id')
+ ->pluck(new Expression('COUNT(i_id) AS total'), 'gedcom_id')
->map(static fn (string $count): int => (int) $count);
}
@@ -263,7 +263,7 @@ class ControlPanel implements RequestHandlerInterface
return DB::table('gedcom')
->leftJoin('families', 'f_file', '=', 'gedcom_id')
->groupBy(['gedcom_id'])
- ->pluck(new Expression('COUNT(f_id)'), 'gedcom_id')
+ ->pluck(new Expression('COUNT(f_id) AS total'), 'gedcom_id')
->map(static fn (string $count): int => (int) $count);
}
@@ -277,7 +277,7 @@ class ControlPanel implements RequestHandlerInterface
return DB::table('gedcom')
->leftJoin('sources', 's_file', '=', 'gedcom_id')
->groupBy(['gedcom_id'])
- ->pluck(new Expression('COUNT(s_id)'), 'gedcom_id')
+ ->pluck(new Expression('COUNT(s_id) AS total'), 'gedcom_id')
->map(static fn (string $count): int => (int) $count);
}
@@ -291,7 +291,7 @@ class ControlPanel implements RequestHandlerInterface
return DB::table('gedcom')
->leftJoin('media', 'm_file', '=', 'gedcom_id')
->groupBy(['gedcom_id'])
- ->pluck(new Expression('COUNT(m_id)'), 'gedcom_id')
+ ->pluck(new Expression('COUNT(m_id) AS total'), 'gedcom_id')
->map(static fn (string $count): int => (int) $count);
}
@@ -309,7 +309,7 @@ class ControlPanel implements RequestHandlerInterface
->where('o_type', '=', Repository::RECORD_TYPE);
})
->groupBy(['gedcom_id'])
- ->pluck(new Expression('COUNT(o_id)'), 'gedcom_id')
+ ->pluck(new Expression('COUNT(o_id) AS total'), 'gedcom_id')
->map(static fn (string $count): int => (int) $count);
}
@@ -327,7 +327,7 @@ class ControlPanel implements RequestHandlerInterface
->where('o_type', '=', Note::RECORD_TYPE);
})
->groupBy(['gedcom_id'])
- ->pluck(new Expression('COUNT(o_id)'), 'gedcom_id')
+ ->pluck(new Expression('COUNT(o_id) AS total'), 'gedcom_id')
->map(static fn (string $count): int => (int) $count);
}
@@ -345,7 +345,7 @@ class ControlPanel implements RequestHandlerInterface
->where('o_type', '=', Submitter::RECORD_TYPE);
})
->groupBy(['gedcom_id'])
- ->pluck(new Expression('COUNT(o_id)'), 'gedcom_id')
+ ->pluck(new Expression('COUNT(o_id) AS total'), 'gedcom_id')
->map(static fn (string $count): int => (int) $count);
}
}
diff --git a/resources/views/lists/locations-table.phtml b/resources/views/lists/locations-table.phtml
index 5133aab440..0910885db4 100644
--- a/resources/views/lists/locations-table.phtml
+++ b/resources/views/lists/locations-table.phtml
@@ -30,7 +30,7 @@ $count_individuals = DB::table('individuals')
->where('l_type', '=', '_LOC')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
@@ -42,7 +42,7 @@ $count_families = DB::table('families')
->where('l_type', '=', '_LOC')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
?>
diff --git a/resources/views/lists/media-table.phtml b/resources/views/lists/media-table.phtml
index cb04880d90..fc76753e64 100644
--- a/resources/views/lists/media-table.phtml
+++ b/resources/views/lists/media-table.phtml
@@ -30,7 +30,7 @@ $count_individuals = DB::table('individuals')
->where('l_type', '=', 'OBJE')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
@@ -42,7 +42,7 @@ $count_families = DB::table('families')
->where('l_type', '=', 'OBJE')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
@@ -54,7 +54,7 @@ $count_sources = DB::table('sources')
->where('l_type', '=', 'OBJE')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
?>
diff --git a/resources/views/lists/notes-table.phtml b/resources/views/lists/notes-table.phtml
index 1536820674..1b01909083 100644
--- a/resources/views/lists/notes-table.phtml
+++ b/resources/views/lists/notes-table.phtml
@@ -30,7 +30,7 @@ $count_individuals = DB::table('individuals')
->where('l_type', '=', 'NOTE')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
@@ -42,7 +42,7 @@ $count_families = DB::table('families')
->where('l_type', '=', 'NOTE')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
@@ -54,7 +54,7 @@ $count_media = DB::table('media')
->where('l_type', '=', 'NOTE')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
@@ -66,7 +66,7 @@ $count_sources = DB::table('sources')
->where('l_type', '=', 'NOTE')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
?>
diff --git a/resources/views/lists/repositories-table.phtml b/resources/views/lists/repositories-table.phtml
index 0e4350a07b..71c82dbb2e 100644
--- a/resources/views/lists/repositories-table.phtml
+++ b/resources/views/lists/repositories-table.phtml
@@ -30,7 +30,7 @@ $count_sources = DB::table('sources')
->where('l_type', '=', 'REPO')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
?>
diff --git a/resources/views/lists/sources-table.phtml b/resources/views/lists/sources-table.phtml
index fdbc8d836f..5fad504224 100644
--- a/resources/views/lists/sources-table.phtml
+++ b/resources/views/lists/sources-table.phtml
@@ -31,7 +31,7 @@ $count_individuals = DB::table('individuals')
->where('l_type', '=', 'SOUR')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
@@ -43,7 +43,7 @@ $count_families = DB::table('families')
->where('l_type', '=', 'SOUR')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
@@ -55,7 +55,7 @@ $count_media = DB::table('media')
->where('l_type', '=', 'SOUR')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
@@ -68,7 +68,7 @@ $count_notes = DB::table('other')
->where('l_type', '=', 'SOUR')
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
?>
diff --git a/resources/views/lists/submitters-table.phtml b/resources/views/lists/submitters-table.phtml
index 3a84b95d5c..a2d555d8f4 100644
--- a/resources/views/lists/submitters-table.phtml
+++ b/resources/views/lists/submitters-table.phtml
@@ -33,7 +33,7 @@ $count_individuals = DB::table('individuals')
->where('l_type', '=', Submitter::RECORD_TYPE)
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
@@ -45,7 +45,7 @@ $count_families = DB::table('families')
->where('l_type', '=', Submitter::RECORD_TYPE)
->where('l_file', '=', $tree->id())
->groupBy(['l_to'])
- ->pluck(new Expression('COUNT(*)'), 'l_to')
+ ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
->map(static fn (string $n): int => (int) $n)
->all();
?>