[GENERAL] Why this regexp matches?!

2012-02-04 Thread hubert depesz lubaczewski
select 'depesz depeszx depesz' ~ E'^(.*)( \\1)+$'; what's worse: $ select regexp_replace( 'depesz depeszx depesz', E'^(.*)( \\1)+$', E'\\1' ); regexp_replace depesz (1 row) I know that Pg regexps are limited, but even grep's regexps match this correctly: =$ printf 'depesz dep

Re: [GENERAL] Why this regexp matches?!

2012-02-04 Thread Szymon Guz
On 4 February 2012 09:46, hubert depesz lubaczewski wrote: > select 'depesz depeszx depesz' ~ E'^(.*)( \\1)+$'; > > what's worse: > $ select regexp_replace( 'depesz depeszx depesz', E'^(.*)( \\1)+$', E'\\1' > ); > regexp_replace > > depesz > (1 row) > > I know that Pg regexps ar

Re: [GENERAL] Why this regexp matches?!

2012-02-04 Thread hubert depesz lubaczewski
On Sat, Feb 04, 2012 at 09:54:34AM +0100, Szymon Guz wrote: > On 4 February 2012 09:46, hubert depesz lubaczewski wrote: > > > select 'depesz depeszx depesz' ~ E'^(.*)( \\1)+$'; > > > > what's worse: > > $ select regexp_replace( 'depesz depeszx depesz', E'^(.*)( \\1)+$', E'\\1' > > ); > > regexp_

Re: [GENERAL] debugging the server[ module causes server cash]

2012-02-04 Thread m...@trausch.us
On 02/04/2012 02:37 AM, Dave Potts wrote: > I have just inherited a private C module that lives in the context of > the server with little or no documentation. > > It crashes taking the database down, is there any advice on how to > debug this type of beast ? > > This is not a problem with the p

Re: [GENERAL] Why this regexp matches?!

2012-02-04 Thread David Johnston
On Feb 4, 2012, at 3:58, hubert depesz lubaczewski wrote: > On Sat, Feb 04, 2012 at 09:54:34AM +0100, Szymon Guz wrote: >> On 4 February 2012 09:46, hubert depesz lubaczewski wrote: >> >>> select 'depesz depeszx depesz' ~ E'^(.*)( \\1)+$'; >>> >>> what's worse: >>> $ select regexp_replace( 'dep

Re: [GENERAL] debugging the server[ module causes server cash]

2012-02-04 Thread Tom Lane
Dave Potts writes: > I have just inherited a private C module that lives in the context of > the server with little or no documentation. > It crashes taking the database down, is there any advice on how to > debug this type of beast ? It isn't a lot different from debugging code that's part of

Re: [GENERAL] Why this regexp matches?!

2012-02-04 Thread Alban Hertroys
On 4 Feb 2012, at 9:46, hubert depesz lubaczewski wrote: > select 'depesz depeszx depesz' ~ E'^(.*)( \\1)+$'; Peculiar. It's probably no use to you, but a version where the repetition is expanded (for that particular string) works: select 'depesz depeszx depesz' ~ E'^(.*)( \\1)( \\1)$'; And t

Re: [GENERAL] Why this regexp matches?!

2012-02-04 Thread hubert depesz lubaczewski
On Sat, Feb 04, 2012 at 07:31:25PM +0100, Alban Hertroys wrote: > > I know that Pg regexps are limited, but even grep's regexps match this > > Limited? They're really not. According to the docs they are beyond > POSIX compliant, even including several extensions as they appear in, > among others,

Re: [GENERAL] Why this regexp matches?!

2012-02-04 Thread Tom Lane
hubert depesz lubaczewski writes: > On Sat, Feb 04, 2012 at 07:31:25PM +0100, Alban Hertroys wrote: >> Limited? They're really not. > Limited - because (for example) Pg regexps, are the only regexp flavour > that I know that you can't have both greedy and non-greedy operators in > the same expres

Re: [GENERAL] Why this regexp matches?!

2012-02-04 Thread hubert depesz lubaczewski
On Sat, Feb 04, 2012 at 03:27:53PM -0500, Tom Lane wrote: > hubert depesz lubaczewski writes: > > that I know that you can't have both greedy and non-greedy operators in > > the same expression. > > Huh? Sure you can. wrote about it year ago: http://archives.postgresql.org/pgsql-general/2010-0