2012-06-20 11 views
5

Sto cercando di eseguire un'applicazione Java Jetty e continuo a vedere questo errore:Postgres manca l'abilità pgcrypt?

Caused by: 
org.postgresql.util.PSQLException: ERROR: function crypt(character varying, character) does not exist| Hint: No function matches the given name and argument types. You might need to add explicit type casts.| Where: PL/pgSQL function 

Qualcuno riconosce questo o come risolvere il problema? Pensavo che pgcrypt fosse prebundled in Postgres 9.1.x?

Attualmente eseguo Mac OSX Lion 10.7 e ho installato Postgres utilizzando brew "brew install postgres".

+1

Anche se 'pgcrypto' è prebundled, il' crypt() '' firma è crypt (testo, testo) 'e non' crypt (character varying, carattere) 'come si è visto dal vostro messaggio di errore (tenere a mind 'text' è equivalente a' character varying'). –

risposta

10

Ho appena dovuto abilitare pgcrypto; appena eseguito dalla CLI:

CREATE EXTENSION pgcrypto;

per gli utenti Mac ne consiglio la lettura di più su birra:

brew info postgres

+0

Grazie per aver suggerito di abilitare questa estensione. Stavo controllando postgres 9.5.3, come creare uuid, automaticamente. Ho trovato https://www.postgresql.org/docs/9.5/static/uuid-ossp.html e suggerendo di usare 'gen_random_uuid();' funzione. Ho abilitato questa estensione e funziona! 'development-db # SELECT gen_random_uuid(); gen_random_uuid -------------------------------------- 40a3e789-a685-4585-abbc- a0a4829402b7 (1 riga) ' – Abhi

0

E ' 'estensione' piuttosto che 'estensioni'. Poiché non posso apportare modifiche a un personaggio, ho dovuto postare una nuova risposta.

CREATE EXTENSION pgcrypto; 
+0

Un commento sarebbe stato in ordine, come questo. Puoi cancellare questa risposta ora, grazie per il suggerimento. –