Substrings by Regular Expression

Поиск
Список
Период
Сортировка
Искать

Substrings by Regular Expression

От:
drumeng@yahoo.com (Jim Drummey)
Дата:
Hello-

The 7.2 version distributed with RedHat 8.0 seems not
to work for substrings and POSIX regular expressions.

I think this should work....

pds=>  select substring( str1 from ',' ) from address;
ERROR:  pg_atoi: error in ",": can't parse ","

Am I missing something?

TIA
J. Drummey
drumeng@yahoo.com

Re: Substrings by Regular Expression

От:
Stephan Szabo <sszabo@megazone.bigpanda.com>
Дата:
On Fri, 14 Nov 2003, Jim Drummey wrote:

> Hello-
>
> The 7.2 version distributed with RedHat 8.0 seems not
> to work for substrings and POSIX regular expressions.
>
> I think this should work....
>
> pds=>  select substring( str1 from ',' ) from address;
> ERROR:  pg_atoi: error in ",": can't parse ","
>
> Am I missing something?

That functionality was added in 7.3 I believe.  You may wish
to upgrade.

Re: Substrings by Regular Expression

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Stephan Szabo  writes:
> On Fri, 14 Nov 2003, Jim Drummey wrote:
>> pds=>  select substring( str1 from ',' ) from address;
>> ERROR:  pg_atoi: error in ",": can't parse ","
>> 
>> Am I missing something?

> That functionality was added in 7.3 I believe.  You may wish
> to upgrade.

Also, it's worth noting that AFAICT the above is illegal per SQL99
--- the textual SUBSTRING variants the spec defines are
         ::=             SUBSTRING   FROM                          [ FOR  ] 
         ::=             SUBSTRING   FROM                          FOR                          

so it looks to me like you can't omit "FOR " if you want to
adhere to the letter of the spec.  We do allow omitting that clause
as a pretty-obvious extension ... but it's important to realize that
it *is* an extension.
		regards, tom lane

FAQ