BUG #3435: problem with substring function

From: "Carlos Quintero" <carlos(dot)quintero(dot)sspa(at)juntadeandalucia(dot)es>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3435: problem with substring function
Date: 2007-07-10 09:55:07
Message-ID: 200707100955.l6A9t7LL063548@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

The following bug has been logged online:

Bug reference: 3435
Logged by: Carlos Quintero
Email address: carlos(dot)quintero(dot)sspa(at)juntadeandalucia(dot)es
PostgreSQL version: 8.2.4
Operating system: Linux RedHat Enterprise 3
Description: problem with substring function


I like to use a numerical expression as parameter for the substring
function, but it works always as i use regular expressions. Please, try

select substring('1234' from to_number('3', '999999') for 3);

What returns a empty string:


(1 fila)

But the right result must be this:

select substring('1234' from 3 for 3);

(1 fila)

If i use other numbers, i got even some errors:

select substring('1234' from to_number('33', '999999') for 3);

ERROR: la expresin regular no es vlida: invalid backreference number
CONTEXTO: funcin SQL substring 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,


Browse pgsql-bugs by date

  From Date Subject
Next Message Pavel Stehule 2007-07-10 10:32:09 Re: BUG #3435: problem with substring function
Previous Message Neil Conway 2007-07-10 06:10:55 Re: numeric stddev_pop and var_pop are wrong