Re: BUG #3435: problem with substring function

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: BUG #3435: problem with substring function
Дата
Msg-id 162867790707100332l549abb1bkb18a52987586352a@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #3435: problem with substring function  ("Carlos Quintero" <carlos.quintero.sspa@juntadeandalucia.es>)
Ответы Re: BUG #3435: problem with substring function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Hello

It has little bit strange behave on 8.3. It works well, but I have to
use casting.

postgres=3D# select substring('1234' from to_number('3', '999999') for 3);
ERROR:  function pg_catalog.substring(unknown, numeric, integer) does not e=
xist
LINE 1: select substring('1234' from to_number('3', '999999') for 3)...
               ^
HINT:  No function matches the given name and argument types. You
might need to add explicit type casts.

postgres=3D# select substring('1234' from to_number('3', '999999')::int for=
 3);
 substring
-----------
 34
(1 row)

Regards
Pavel Stehule



2007/7/10, Carlos Quintero <carlos.quintero.sspa@juntadeandalucia.es>:
>
> The following bug has been logged online:
>
> Bug reference:      3435
> Logged by:          Carlos Quintero
> Email address:      carlos.quintero.sspa@juntadeandalucia.es
> PostgreSQL version: 8.2.4
> Operating system:   Linux RedHat Enterprise 3
> Description:        problem with substring function
> Details:
>
> Hi,
>
> I like to use a numerical expression as parameter for the substring
> function, but it works always as i use regular expressions. Please, try
> this:
>
> select substring('1234' from to_number('3', '999999') for 3);
>
> What returns a empty string:
>
>  substring
> -----------
>
> (1 fila)
>
> But the right result must be this:
>
> select substring('1234' from 3 for 3);
>
>  substring
> -----------
>  34
> (1 fila)
>
> If i use other numbers, i got even some errors:
>
> select substring('1234' from to_number('33', '999999') for 3);
>
> ERROR:  la expresi=F3n regular no es v=E1lida: invalid backreference numb=
er
> CONTEXTO:  funci=F3n SQL =ABsubstring=BB en la sentencia 1
>
> This is a sample, really i like to use an expression using date_part() as
> the first parameter for substring.
>
>
> Best Regards,
> Carlos
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Carlos Quintero"
Дата:
Сообщение: BUG #3435: problem with substring function
Следующее
От: "FAGOT Alain"
Дата:
Сообщение: BUG #3436: inherited primary keys are not reported as primary key by the Java DatabaseMetaData