fix: query logic bug (#2631)

This commit is contained in:
matt
2025-12-09 21:08:11 -05:00
committed by GitHub
parent 3ff672ebe4
commit eac6904fb6
2 changed files with 2 additions and 4 deletions

View File

@@ -501,11 +501,10 @@ func InsertCutOverOLAPPayloadsIntoTempTable(ctx context.Context, tx DBTX, tableN
FROM inputs
ORDER BY tenant_id, external_id, inserted_at
ON CONFLICT(tenant_id, external_id, inserted_at) DO NOTHING
RETURNING *
)
SELECT tenant_id, external_id, inserted_at
FROM inserts
FROM inputs
ORDER BY tenant_id DESC, external_id DESC, inserted_at DESC
LIMIT 1
`,

View File

@@ -72,11 +72,10 @@ func InsertCutOverPayloadsIntoTempTable(ctx context.Context, tx DBTX, tableName
FROM inputs
ORDER BY tenant_id, inserted_at, id, type
ON CONFLICT(tenant_id, id, inserted_at, type) DO NOTHING
RETURNING *
)
SELECT tenant_id, inserted_at, id, type
FROM inserts
FROM inputs
ORDER BY tenant_id DESC, inserted_at DESC, id DESC, type DESC
LIMIT 1
`,