You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
In postgresql, you can easily return the current state of a record after insert or update by using RETURNING *. So if you had a set of records that you updated, you can update a single field and then return the current state of the entire record.
ex:
CREATETABLEusers (firstname text, lastname text, id serialprimary key);
INSERT INTO users (firstname, lastname) VALUES ('Joe', 'Cool') RETURNING *;
UPDATEsandbox.test_tableSET firstname ='bob'WHERE id =1 RETURNING *;
So say hypothetically we have a set of keys of the following format in redis
I've run into a situation where, after performing a transaction of many HSET/HMSET operations, I'll have to run a separate pipeline/transaction of HGETALL operations in order to return the state of records after the HSET/HMSET operation (requirement for front end). I'll be doing this on hundreds, possibly a thousand records per request.
It would be nice if we could replicate the functionality of RETURNING * via redis for hashes. It could be some sort of command, for the sake of example I'll call it HMSETRET and HSETRET (RET for RETURN), which would be the equivalent of running HSET/HGET or HMSET/HGETALL ran sequentially.
In postgresql, you can easily return the current state of a record after insert or update by using
RETURNING *
. So if you had a set of records that you updated, you can update a single field and then return the current state of the entire record.ex:
So say hypothetically we have a set of keys of the following format in redis
I've run into a situation where, after performing a transaction of many
HSET/HMSET
operations, I'll have to run a separate pipeline/transaction ofHGETALL
operations in order to return the state of records after the HSET/HMSET operation (requirement for front end). I'll be doing this on hundreds, possibly a thousand records per request.It would be nice if we could replicate the functionality of
RETURNING *
via redis for hashes. It could be some sort of command, for the sake of example I'll call itHMSETRET
andHSETRET
(RET for RETURN), which would be the equivalent of running HSET/HGET or HMSET/HGETALL ran sequentially.ex:
This would allow for one single transaction or pipeline to run which would update information and return records back in one fell swoop.
The text was updated successfully, but these errors were encountered: