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
They are useful in some situations, for example I use xmax to detect conflicts when inserting objects with randomly generated, human readable IDs.
INSERT INTO objects (
id,
created,
location
) VALUES ($1, CURRENT_TIMESTAMP, $2)
ON CONFLICT (id) DO NOTHING
RETURNING (xmax = 0) AS conflict_free
Then I can check conflict_free in my application logic and retry with a new ID if it's set. I suppose the other way to do this is to drop the ON CONFLICT DO NOTHING but now I have to catch the exception, verify it failed due to the conflict and not some other problem, and retry etc. Overall I think it's better to do this than to handle control flow via exceptions.
Anyway, with reshape views, none of these columns are available. Would it be reasonable to surface any of these system columns? They don't seem problematic to me but I'm not very familiar with how reshape works under the hood.
The text was updated successfully, but these errors were encountered:
In postgres every table has a number of additional columns: https://www.postgresql.org/docs/9.1/ddl-system-columns.html
They are useful in some situations, for example I use xmax to detect conflicts when inserting objects with randomly generated, human readable IDs.
Then I can check
conflict_free
in my application logic and retry with a new ID if it's set. I suppose the other way to do this is to drop theON CONFLICT DO NOTHING
but now I have to catch the exception, verify it failed due to the conflict and not some other problem, and retry etc. Overall I think it's better to do this than to handle control flow via exceptions.Anyway, with reshape views, none of these columns are available. Would it be reasonable to surface any of these system columns? They don't seem problematic to me but I'm not very familiar with how reshape works under the hood.
The text was updated successfully, but these errors were encountered: