Replies: 1 comment
-
converted to issue #10489 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to create a custom SQL function that generates an id in a format such as
pc_1Pa04ELJnaZjX5rdwAEd0YMV
. Id like to use this as the default value of a id field (type text). Similar to how gen_uuid() can be used for UUID type fields.I realize that the Hasura docs have some suggested method for this however it requires enabling null values on the field. However I do not want to enable null values on the id field. Is there a way to make custom functions work as defaults just like the gen_uuid() function?
Hasura (OSS) v2
Here's an example of the sql function im trying to use: https://github.com/elitan/postgres-nanoid/blob/main/nanoid.sql
I then create another function that uses nanoid and takes 0 args
Id then expect
userid()
to appear in this list of default functions:The current guidance found in the docs is not ideal. I don't want to set id to null for data integrity reasons.
Beta Was this translation helpful? Give feedback.
All reactions