All functions in pg_catalog
are automatically available within other schemas.
Any function with schema pg_catalog
can be called by using schema for example pg_catalog.gen_random_uuid()
, but also without defining the schema, for example gen_random_uuid()
.
Function gen_random_uuid()
is part of extension pgcrypto
, so when you are trying to enable it, it notifies you, that this function is already installed.
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA pg_catalog CASCADE;
On most cases is recommended to install common Postgres extensions into pg_catalog
, so these are available within any schema. All objects in pg_catalog
are automatically appended to any other schema. For example if you put pgcrypto
into public
schema, then you have to always use public.gen_random_uuid()
within any other schema, which is annoying etc. But if you put it into pg_catalog
, then you can call anywhere gen_random_uuid()
, which is more useful.