Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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,


pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group