Re: [pgsql-es-ayuda] Identificador único con md5()

From: Emanuel Calvo Franco <postgres(dot)arg(at)gmail(dot)com>
To: Sebastián Villalba <sebastian(at)fcm(dot)unc(dot)edu(dot)ar>
Cc: Lista Ayuda Pgsql <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: [pgsql-es-ayuda] Identificador único con md5()
Date: 2010-02-24 20:04:15
Message-ID: f205bb121002241204r2290c083n7a9ba0b16caa87ec@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

> En Postgres 8.2 anda perfecto:
>
> postgres=# SELECT upper(substring(md5(CURRENT_TIME::time)from 7 for 7))AS
> mi_identificador ;
>  mi_identificador
> ------------------
>  CC8670A
> (1 fila)
>
> postgres=# SELECT upper(substring(md5(CURRENT_TIME::time)from 7 for 7))AS
> mi_identificador ;
>  mi_identificador
> ------------------
>  9514C4D
> (1 fila)
>
> Pero en 8.4:
>
> postgres=# SELECT upper(substring(md5(CURRENT_TIME::time)from 7 for 7))AS
> mi_identificador ;
> ERROR:  no existe la función md5(time without time zone)
> LÍNEA 1: SELECT upper(substring(md5(CURRENT_TIME::time)from 7 for 7))...
>                                ^
> SUGERENCIA:  Ninguna función coincide en el nombre y tipos de argumentos.
> Puede desear agregar conversión explícita de tipos.
>
> ¿Hay forma para que el md5 tome como entrada la salida del CURRENT_TIME como
> lo hacía en la versión 8.2?

SELECT upper(substring(md5(CURRENT_TIME::text)from 7 for 7)) AS
mi_identificador ;

--
Emanuel Calvo Franco
DBA at: www.siu.edu.ar
www.emanuelcalvofranco.com.ar
Join: http://www.thevenusproject.com/

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2010-02-24 20:06:45 Re: B-Tree o HASH
Previous Message Alvaro Herrera 2010-02-24 20:03:34 Re: Identificador único con md5()