I want to generate a v4 uuid in PostgreSQL using the extension uuid-ossp, so in psql I ran:


Then I ran SELECT uuid_generate_v1(); or SELECT uuid_generate_v4(); but I always get this error:

ERROR:  function uuid_generate_v1() does not exist
LINE 1: select uuid_generate_v1();
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

So how can I solve this error?

  • 1
    What is the output of show search_path;? – CL. Aug 20 '19 at 6:56

There are several possibilities:

  • you ran CREATE EXTENSION in a different database (postgres?)

  • you installed the extension in a schema that is not on the user's search_path.


\dx "uuid-ossp"

in psql to see where the extension is installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.