fix: use COUNT(*) instead of COUNT(DISTINCT po.id) in catalog-reconcile
price_observations table has no id column — replace with COUNT(*) to avoid SQL error 42703.
This commit is contained in:
parent
98b241f462
commit
1edd6c20a8
@ -175,7 +175,7 @@ export async function runCatalogReconcile(): Promise<ReconcileResult> {
|
||||
SELECT t.id AS competitor_id, t.part_number, t.standard_name,
|
||||
t.form_factor, t.speed_gbps, t.fiber_type, t.reach_meters,
|
||||
t.wavelengths, v.name AS vendor_name,
|
||||
MAX(po.time) AS last_price, COUNT(DISTINCT po.id) AS price_count
|
||||
MAX(po.time) AS last_price, COUNT(*) AS price_count
|
||||
FROM transceivers t
|
||||
JOIN vendors v ON v.id = t.vendor_id
|
||||
JOIN price_observations po ON po.transceiver_id = t.id
|
||||
@ -187,7 +187,7 @@ export async function runCatalogReconcile(): Promise<ReconcileResult> {
|
||||
AND t.id != $3
|
||||
GROUP BY t.id, t.part_number, t.standard_name, t.form_factor,
|
||||
t.speed_gbps, t.fiber_type, t.reach_meters, t.wavelengths, v.name
|
||||
HAVING COUNT(DISTINCT po.id) >= 1
|
||||
HAVING COUNT(*) >= 1
|
||||
`, [fx.form_factor, fx.speed_gbps, fx.id]);
|
||||
|
||||
for (const cand of candidates) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user