Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2010
    Posts
    7

    Unanswered: PostgreSQL crypt() function.

    Hello,

    I come from MySQL and I am new for 'PostgreSQL World'.

    I need to hashing a password with the crypt() function. My query is:

    Code:
    UPDATE public.accounts SET account_hash = crypt('hello', gen_salt('md5'));
    where account_hash is a charatcter data type.
    The SQL error is:

    Code:
    ERROR:  function gen_salt(unknown) does not exist
    LINE 1: ... public.accounts SET account_hash = crypt('cane', gen_salt('...
                                                                 ^
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
    Where is the problem?

  2. #2
    Join Date
    Aug 2009
    Location
    Olympia, WA
    Posts
    337
    Well pgcrypto is a contrib module so its not installed by default. So making sure that you've installed it would be a good start.

    There are install scripts in the contrib directory of Postgres.

  3. #3
    Join Date
    Mar 2010
    Posts
    7
    Quote Originally Posted by artacus72 View Post
    Well pgcrypto is a contrib module so its not installed by default. So making sure that you've installed it would be a good start.

    There are install scripts in the contrib directory of Postgres.
    Thanks, now I try to install pgcrypto

  4. #4
    Join Date
    Mar 2010
    Posts
    7
    Thank you artacus72, it's all ok!
    Good day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •