0

I am getting the following uuid error while running a rails app with postgres as backend. Can someone help me out with which dependency is needed.

 [root@localhost webapp]# rake db:migrate
    (in /root/mysite/webapp)
    ==  CreateContributors: migrating =============================================
    -- create_table(:contributors, {:id=>false})
       -> 0.0121s
    -- execute("alter table contributors add primary key (id)")
    NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create implicit index "contributors_pkey" for table "contributors"
       -> 0.0797s
    -- execute("alter table contributors alter column id set default uuid_generate_v1()::varchar")
    rake aborted!
    An error has occurred, this and all later migrations canceled:

    PGError: ERROR:  function uuid_generate_v1() does not exist
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
    : alter table contributors alter column id set default uuid_generate_v1()::varchar

1 Answer 1

1

The uuid_generate_v1() function is part of the uuid-ossp package and you have to install that into PostgreSQL before you can use it. You should have a file called uuid-ossp.sql in your PostgreSQL contrib directory. You can install the package with:

$ psql -d your_database < /the/path/to/uuid-ossp.sql

You'll probably want to run that as the database super user.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks it worked now actually path was a problem it was in pgsql/contrib and i was looking in postgres folder
The directory on ubuntu for this file seems to be: /usr/share/postgresql/[postgres-version]/extension

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.