mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-08 10:27:08 +02:00
fix(pglite): qualify the artwork_queue upsert priority column
In PostgreSQL, a bare column name in ON CONFLICT DO UPDATE is ambiguous between the target row and excluded, and MAX() is an aggregate rather than the two-argument function SQLite provides. Every artwork enqueue failed with 'column reference "priority" is ambiguous' on a real library.
This commit is contained in:
parent
99c9adc69e
commit
4da3f3510b
1 changed files with 2 additions and 2 deletions
|
|
@ -47,13 +47,13 @@ func (r *artworkQueueRepository) Get(kind model.Kind, id, imageType string) (*mo
|
|||
// row's spent retry budget) and clears trace (so explain does not show a prior failure at attempts 0).
|
||||
func (r *artworkQueueRepository) Enqueue(items ...model.ArtworkQueueItem) error {
|
||||
return r.enqueue(`ON CONFLICT (item_kind, item_id, image_type) DO UPDATE SET
|
||||
priority = MAX(priority, excluded.priority), retry_at = excluded.retry_at,
|
||||
priority = GREATEST(artwork_queue.priority, excluded.priority), retry_at = excluded.retry_at,
|
||||
attempts = 0, enqueued_at = excluded.enqueued_at, trace = '[]'`, items)
|
||||
}
|
||||
|
||||
func (r *artworkQueueRepository) EnqueuePreservingBackoff(items ...model.ArtworkQueueItem) error {
|
||||
return r.enqueue(`ON CONFLICT (item_kind, item_id, image_type) DO UPDATE SET
|
||||
priority = MAX(priority, excluded.priority)`, items)
|
||||
priority = GREATEST(artwork_queue.priority, excluded.priority)`, items)
|
||||
}
|
||||
|
||||
func (r *artworkQueueRepository) EnqueueAllMissing(kind model.Kind, priority int) (int64, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue