Re: Consulta sobre funciones en la version 8.3.1

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Diego Ayala" <netdiego81(at)gmail(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Consulta sobre funciones en la version 8.3.1
Date: 2008-04-02 05:31:36
Message-ID: c2d9e70e0804012231n30abfe16q6a7095e666e82359@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

2008/3/31 Diego Ayala <netdiego81(at)gmail(dot)com>:
>
> select substr(current_date,1,4)
>
> ERROR: no existe la función substr(date, integer, integer)
> LINE 1: select substr(current_date,1,4)
> ^
> HINT: Ninguna función coincide en el nombre y tipos de argumentos. Puede
> desear agregar conversión explícita de tipos.
>
> Entiendo que no se puede realizar un substr de current_date, ya que
> casteando si ejecuta la sentencia
>
> select substr(current_date::text,1,4)
>
> 2008
>
> sin embargo en la version 8.2.3 al ejecutar esta misma sentencia lo hace sin
> necesidad de realizar el cast.
>

asi es, eso cambio en 8.3

http://www.postgresql.org/docs/current/static/release-8-3.html
"""
Non-character data types are no longer automatically cast to TEXT (Peter, Tom)

Previously, if a non-character value was supplied to an operator or
function that requires text input, it was automatically cast to text,
for most (though not all) built-in data types. This no longer happens:
an explicit cast to text is now required for all non-character-string
types. For example, these expressions formerly worked:

substr(current_date, 1, 4)
23 LIKE '2%'but will now draw "function does not exist" and "operator
does not exist" errors respectively. Use an explicit cast instead:

substr(current_date::text, 1, 4)
23::text LIKE '2%'
"""

>
> la consulta que tengo es, en esta nueva versión 8.3.1, ya valida que no se
> realice un substr de current_date, ??

no, lo que hace es NO realizar un cast implicito a text

> conocen algunas otras funciones que
> cambian respecto a su funcionamiento ? con versiones anteriores del
> PostgreSQL 8.3.1
>

date leida de esto
http://www.postgresql.org/docs/current/static/release-8-3.html

--
Atentamente,
Jaime Casanova

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Julio Cesar Sánchez González 2008-04-02 06:07:09 Re: Sobre WIN1252
Previous Message Raul Lapitzondo 2008-04-02 04:50:25 RE: parametro tipo TIME