Kind people,

Please find enclosed a patch exemplifying typical use of the ARE
Class-Shorthand EscapesÂ®.  I believe it will help intrepid regex
users. :)

Cheers,
D
-- 
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100    cell: +1 415 235 3778
Sat, 6 Dec 2003 17:53:07 -0800
David Fetter <david@fetter.org>
Double Backslash example patch
David Fetter wrote:
> Please find enclosed a patch exemplifying typical use of the ARE
> Class-Shorthand EscapesÂ®.  I believe it will help intrepid regex
> users. :)

If you want to explain something, it's normally better to create an 
example just for that point, instead of piggybacking it onto another 
example. Else you just make it harder for people to recognize the 
relevant information.

For instance, in the case you want to patch the example aims to show how 
patterns are not anchored, as opposed to the pattern for the LIKE 
operator.  What does the escape syntax of the pattern have to do with 
that?


Sun, 7 Dec 2003 10:53:44 +0100
Peter Eisentraut <peter_e@gmx.net>
Re: Double Backslash example patch
Peter Eisentraut wrote:
> David Fetter wrote:
> > Please find enclosed a patch exemplifying typical use of the ARE
> > Class-Shorthand Escapes??.  I believe it will help intrepid regex
> > users. :)
> 
> If you want to explain something, it's normally better to create an 
> example just for that point, instead of piggybacking it onto another 
> example. Else you just make it harder for people to recognize the 
> relevant information.
> 
> For instance, in the case you want to patch the example aims to show how 
> patterns are not anchored, as opposed to the pattern for the LIKE 
> operator.  What does the escape syntax of the pattern have to do with 
> that?

He is reminding folks about double-backslashes in a relivant place ---
makes sense to me.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Mon, 15 Dec 2003 20:22:50 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Double Backslash example patch

Your patch has been added to the PostgreSQL unapplied patches list at:

	http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


David Fetter wrote:
> Kind people,
> 
> Please find enclosed a patch exemplifying typical use of the ARE
> Class-Shorthand Escapes®.  I believe it will help intrepid regex
> users. :)
> 
> Cheers,
> D
> -- 
> David Fetter david@fetter.org http://fetter.org/
> phone: +1 510 893 6100    cell: +1 415 235 3778

[ Attachment, skipping... ]

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Mon, 15 Dec 2003 20:22:53 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Double Backslash example patch
Bruce Momjian writes:
>
> Your patch has been added to the PostgreSQL unapplied patches list at:
>
> 	http://momjian.postgresql.org/cgi-bin/pgpatches
>
> I will try to apply it within the next 48 hours.

Please don't.

Add a new example if you want, but don't overload existing examples with
unrelated information.

>
> ---------------------------------------------------------------------------
>
>
> David Fetter wrote:
>> Kind people,
>>
>> Please find enclosed a patch exemplifying typical use of the ARE
>> Class-Shorthand EscapesÂ®.  I believe it will help intrepid regex
>> users. :)
>>
>> Cheers,
>> D
>> --
>> David Fetter david@fetter.org http://fetter.org/
>> phone: +1 510 893 6100    cell: +1 415 235 3778
>
> [ Attachment, skipping... ]
>
>>
>> ---------------------------(end of
>> broadcast)--------------------------- TIP 4: Don't 'kill -9' the
>> postmaster
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania
> 19073




Tue, 16 Dec 2003 10:05:23 +0100 (CET)
"Peter Eisentraut" <peter_e@gmx.net>
Re: Double Backslash example patch
Bruce Momjian wrote:
> He is reminding folks about double-backslashes in a relivant place
> --- makes sense to me.

The relevant place would be far below where it already says:

Note: Keep in mind that an escape's leading \ will need to be doubled 
when entering the pattern as an SQL string constant.

So it's already covered.


Tue, 16 Dec 2003 16:32:37 +0100
Peter Eisentraut <peter_e@gmx.net>
Re: Double Backslash example patch
On Tue, Dec 16, 2003 at 04:32:37PM +0100, Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > He is reminding folks about double-backslashes in a relivant place
> > --- makes sense to me.
> 
> The relevant place would be far below where it already says:
> 
> Note: Keep in mind that an escape's leading \ will need to be
> doubled when entering the pattern as an SQL string constant.
> 
> So it's already covered.

With all due respect, Peter, it is only implicit in the docs, and that
is not always good enough.  An explicit example will help, as
PostgreSQL's quoting system would qualify for an early place on the
'gotchas' page (cf. http://sql-info.de/mysql/gotchas.html) if
PostgreSQL had one.

Cheers,
D
-- 
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100    cell: +1 415 235 3778

Tue, 16 Dec 2003 11:17:11 -0800
David Fetter <david@fetter.org>
Re: Double Backslash example patch
On Tue, Dec 16, 2003 at 11:17:11AM -0800, David Fetter wrote:

[Moved to hackers -- this belongs to -docs anyway, doesn't it?]

> With all due respect, Peter, it is only implicit in the docs, and that
> is not always good enough.  An explicit example will help, as
> PostgreSQL's quoting system would qualify for an early place on the
> 'gotchas' page (cf. http://sql-info.de/mysql/gotchas.html) if
> PostgreSQL had one.

BTW, what happened to the $QUOTE$ quoting idea?  Was it applied, or
even developed?

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The problem with the future is that it keeps turning into the present"
(Hobbes)

Tue, 16 Dec 2003 16:31:36 -0300
Alvaro Herrera <alvherre@dcc.uchile.cl>
Re: [PATCHES] Double Backslash example patch
David Fetter wrote:
> With all due respect, Peter, it is only implicit in the docs, and
> that is not always good enough.  An explicit example will help, as

Sure, I'm just pointing out the most appropriate place to put it.


Tue, 16 Dec 2003 20:32:52 +0100
Peter Eisentraut <peter_e@gmx.net>
Re: Double Backslash example patch
On Tue, 16 Dec 2003, Alvaro Herrera wrote:

> BTW, what happened to the $QUOTE$ quoting idea?  Was it applied, or
> even developed?

I believe it's still on the to-do list, but was pushed off until 7.5 or
whenever it gets done.

Jon

Tue, 16 Dec 2003 20:18:34 +0000 (UTC)
Jon Jensen <jon@endpoint.com>
Re: [PATCHES] Double Backslash example patch
Alvaro Herrera wrote:
> On Tue, Dec 16, 2003 at 11:17:11AM -0800, David Fetter wrote:
> 
> [Moved to hackers -- this belongs to -docs anyway, doesn't it?]
> 
> > With all due respect, Peter, it is only implicit in the docs, and that
> > is not always good enough.  An explicit example will help, as
> > PostgreSQL's quoting system would qualify for an early place on the
> > 'gotchas' page (cf. http://sql-info.de/mysql/gotchas.html) if
> > PostgreSQL had one.
> 
> BTW, what happened to the $QUOTE$ quoting idea?  Was it applied, or
> even developed?

Not implemented yet.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Tue, 16 Dec 2003 20:06:49 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: [PATCHES] Double Backslash example patch
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> BTW, what happened to the $QUOTE$ quoting idea?  Was it applied, or
> even developed?

I'd like to see it done for 7.5, but haven't personally had time to go
further than the proof-of-concept backend patch I posted awhile ago.

I think the minimum amount of additional work that has to be done before
we can apply it is to teach psql's input parser about $QUOTE$ ---
without that, the feature is not only useless but counterproductive.
After that we could get on with teaching pg_dump and other stuff about
it, at our leisure.

Any volunteers to fix psql?

			regards, tom lane

Wed, 17 Dec 2003 03:25:03 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: [PATCHES] Double Backslash example patch 
Tom Lane wrote:

>
>I think the minimum amount of additional work that has to be done before
>we can apply it is to teach psql's input parser about $QUOTE$ ---
>without that, the feature is not only useless but counterproductive.
>  
>
IMHO it's not useless. pgAdmin already knows that quoting scheme... not 
yet tested, I'll have to check that patch.

Regards,
Andreas


Wed, 17 Dec 2003 14:57:29 +0100
Andreas Pflug <pgadmin@pse-consulting.de>
Re: [PATCHES] Double Backslash example patch
Andreas Pflug wrote:

> Tom Lane wrote:
>
>>
>> I think the minimum amount of additional work that has to be done before
>> we can apply it is to teach psql's input parser about $QUOTE$ ---
>> without that, the feature is not only useless but counterproductive.
>>  
>>
> IMHO it's not useless. pgAdmin already knows that quoting scheme... 
> not yet tested, I'll have to check that patch.
>

OTOH we sure want it for psql - being able to use this in scripts fed to 
psql is very important IMNSHO.

I see that psql/mainloop.c contains this comment:

 * FIXME: rewrite this whole thing with flex

Is now the time to do that? It would be a pity if substantial changes 
were made here only to be thrown away ...

cheers

andrew


Wed, 17 Dec 2003 12:12:11 -0500
Andrew Dunstan <andrew@dunslane.net>
Re: [PATCHES] Double Backslash example patch
Andrew Dunstan <andrew@dunslane.net> writes:
> I see that psql/mainloop.c contains this comment:
>  * FIXME: rewrite this whole thing with flex
> Is now the time to do that?

If you feel like giving it a shot, ain't nobody gonna stand in your way.
MainLoop() is well past the level of unmaintainability IMHO (which is
why I'd not tried to touch it in the original quick patch).

I'm not totally convinced that flex can do the job, but in any case a
ground-up redesign for legibility might be the only cure.

			regards, tom lane

Wed, 17 Dec 2003 13:07:35 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: [PATCHES] Double Backslash example patch 
Tom Lane wrote:

>Andrew Dunstan <andrew@dunslane.net> writes:
>  
>
>>I see that psql/mainloop.c contains this comment:
>> * FIXME: rewrite this whole thing with flex
>>Is now the time to do that?
>>    
>>
>
>If you feel like giving it a shot, ain't nobody gonna stand in your way.
>MainLoop() is well past the level of unmaintainability IMHO (which is
>why I'd not tried to touch it in the original quick patch).
>
>I'm not totally convinced that flex can do the job, but in any case a
>ground-up redesign for legibility might be the only cure.
>
>  
>

I will take a look - no guarantees though. I agree that flex might well 
end up making things more obscure than less.

Keeping track of open quote operators to make sure we have proper 
nesting and closing looks like it might be a bit messy, but doable.

cheers

andrew


Wed, 17 Dec 2003 13:49:31 -0500
Andrew Dunstan <andrew@dunslane.net>
Re: [PATCHES] Double Backslash example patch
I have applied your additional example in the place Peter suggested. 
Patch attached.

---------------------------------------------------------------------------

David Fetter wrote:
> Kind people,
> 
> Please find enclosed a patch exemplifying typical use of the ARE
> Class-Shorthand Escapes®.  I believe it will help intrepid regex
> users. :)
> 
> Cheers,
> D
> -- 
> David Fetter david@fetter.org http://fetter.org/
> phone: +1 510 893 6100    cell: +1 415 235 3778

[ Attachment, skipping... ]

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Index: doc/src/sgml/func.sgml
===================================================================
RCS file: /cvsroot/pgsql-server/doc/src/sgml/func.sgml,v
retrieving revision 1.182
diff -c -c -r1.182 func.sgml
*** doc/src/sgml/func.sgml	16 Dec 2003 15:27:58 -0000	1.182
--- doc/src/sgml/func.sgml	18 Dec 2003 03:53:59 -0000
***************
*** 3134,3140 ****
     <note>
      <para>
       Keep in mind that an escape's leading <literal>\</> will need to be
!      doubled when entering the pattern as an SQL string constant.
      </para>
     </note>
  
--- 3134,3143 ----
     <note>
      <para>
       Keep in mind that an escape's leading <literal>\</> will need to be
!      doubled when entering the pattern as an SQL string constant.  For example:
! <programlisting>
! '123' ~ '^\\d{3}' <lineannotation>true</lineannotation>
! </programlisting>
      </para>
     </note>
Wed, 17 Dec 2003 22:58:46 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Double Backslash example patch