hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.09k stars 2.76k forks source link

Can we query system columns like `xmin` directly by GraphQL? #6486

Open Hong-Xiang opened 3 years ago

Hong-Xiang commented 3 years ago

System columns like xmin seems not exposed to GraphQL api, at least for default settings. It seems we can not add column xmin to GraphQL schema via web console. Although we can define view with system columns for all tables, it might be more convenient if we can just use the original table.

Some times system columns may be useful, e.g. xmin as concurrency tokens.

tirumaraiselvan commented 3 years ago

A view would be the quickest workaround!

istarkov commented 2 years ago

But what to do if I want to use xmin in mutation to prevent update changed row?

capitlux commented 4 months ago

Hi,

Maybe can we use increment operators (_inc) to manage a "row_version" column since the _inc query is guaranteed to run atomically? The aim is to add row_version in the WHERE clause to ensure the row hasn't changed between states.

@tirumaraiselvan What do you think?

image

Jonathan