remove direct use of gen_random_uuid to avoid dropping column default #4217
Labels
c/server
Related to server
p/longterm
Low priority issues that will be picked up based on user feedback or bandwidth
Hasura installs pgcrypto during initialization. This provides the function
gen_random_uuid()
which is used in manyhdb_catalog
tables as column DEFAULT.Now, pgcrypto components are installed in public schema (although extensions itself are db wide). The reason for this is mentioned here: #3657 (comment)
The problem is that people might want to do
DROP SCHEMA public
. This will throw dependency error thatgen_random_uuid()
is being used by other tables but this could be overridden withDROP SCHEMA public CASCADE
. The effect of that is the column DEFAULT is dropped which leads to issues like #4009One way to workaround is this is to create a UDF like so:
Since, this only indirectly uses
gen_random_uuid()
, the column default is not dropped if pgcrypto or public schema is dropped. See https://www.postgresql.org/docs/9.1/ddl-depend.htmlWe should migrate all uses of
gen_random_uuid()
tohasura_catalog.hasura_uuid()
The text was updated successfully, but these errors were encountered: