Skip to content

Console: gen_random_uuid() should be available for uuid fields like now() for timestamp fields when using mutations #8858

Answered by plcplc
Zerebokep asked this question in General
Discussion options

You must be logged in to vote

As such, this is not a mechanism that Hasura provides, but rather it's Postgres itself which accepts that string as valid input text for the purpose of constructing a timestamp value (along with various others).

So unfortunately there's no existing place we could extend to provide similar support for using gen_random_uuid() for uuid columns.

Postgres it seems doesn't let you overload the accepted textual input formats of a type, but it is possible to supply your own parsing function to custom types.

So in theory you should be able to define your own uuid type which supports gen_random_uuid in addition to literal uuids, although the practical value of doing this is questionable.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Zerebokep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
General
Labels
k/enhancement New feature or improve an existing feature c/console Related to console
3 participants
Converted from issue

This discussion was converted from issue #8731 on August 25, 2022 11:49.