fix: try to fix psql 🐶

v1.18.x
Baris Usakli 6 years ago
parent 31ccc860d3
commit 2e6b562f1e

@ -107,12 +107,17 @@ SELECT $1::TEXT, v, s
async.apply(helpers.ensureLegacyObjectsType, tx.client, keys, 'zset'), async.apply(helpers.ensureLegacyObjectsType, tx.client, keys, 'zset'),
async.apply(query, { async.apply(query, {
name: 'sortedSetsAdd', name: 'sortedSetsAdd',
text: ` text: isArrayOfScores ? `
INSERT INTO "legacy_zset" ("_key", "value", "score") INSERT INTO "legacy_zset" ("_key", "value", "score")
SELECT k, $2::TEXT, $3::NUMERIC SELECT k, $2::TEXT, s
FROM UNNEST($1::TEXT[]) k FROM UNNEST($1::TEXT[], $3::NUMERIC[]) vs(k, s)
ON CONFLICT ("_key", "value") ON CONFLICT ("_key", "value")
DO UPDATE SET "score" = $3::NUMERIC`, DO UPDATE SET "score" = EXCLUDED."score"` : `
INSERT INTO "legacy_zset" ("_key", "value", "score")
SELECT k, $2::TEXT, $3::NUMERIC
FROM UNNEST($1::TEXT[]) k
ON CONFLICT ("_key", "value")
DO UPDATE SET "score" = $3::NUMERIC`,
values: [keys, value, scores], values: [keys, value, scores],
}), }),
], function (err) { ], function (err) {

Loading…
Cancel
Save