> Update of /usr/local/cvsroot/pgsql/src/backend/parser
> In directory hub.org:/tmp/cvs-serv80148/parser
> 
> Modified Files:
> 	gram.y 
> Log Message:
> Repair recently-introduced error in makeIndexable for LIKE:
> a non-leading % would be put into the >=/<= patterns.  Also, repair
> longstanding confusion about whether %% means a literal %%.  The SQL92
> doesn't say any such thing, and textlike() knows that, but gram.y didn't.
> 
> 

Houston, we have a problem.  DoMatch has:

            case '%':
                /* %% is the same as % according to the SQL standard */
                /* Advance past all %'s */
                while (*p == '%')

Don't we want %% to be %?

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Mon, 7 Jun 1999 10:42:07 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [COMMITTERS] 'pgsql/src/backend/parser gram.y'
Bruce Momjian <maillist@candle.pha.pa.us> writes:
>> Repair recently-introduced error in makeIndexable for LIKE:
>> a non-leading % would be put into the >=/<= patterns.  Also, repair
>> longstanding confusion about whether %% means a literal %%.  The SQL92
>> doesn't say any such thing, and textlike() knows that, but gram.y didn't.

> Houston, we have a problem.  DoMatch has:

>             case '%':
>                 /* %% is the same as % according to the SQL standard */
>                 /* Advance past all %'s */
>                 while (*p == '%')

> Don't we want %% to be %?

I looked at the spec, and this piece of code is right: there is nothing
in the spec that says that %% means anything other than two string
pattern matches (which of course has the same effect as one).  So I made
gram.y agree.

It could be that people like Microsoft don't follow the spec... can
anyone check this?

			regards, tom lane

Mon, 07 Jun 1999 11:06:07 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: [COMMITTERS] 'pgsql/src/backend/parser gram.y' 
> Bruce Momjian <maillist@candle.pha.pa.us> writes:
> >> Repair recently-introduced error in makeIndexable for LIKE:
> >> a non-leading % would be put into the >=/<= patterns.  Also, repair
> >> longstanding confusion about whether %% means a literal %%.  The SQL92
> >> doesn't say any such thing, and textlike() knows that, but gram.y didn't.
> 
> > Houston, we have a problem.  DoMatch has:
> 
> >             case '%':
> >                 /* %% is the same as % according to the SQL standard */
> >                 /* Advance past all %'s */
> >                 while (*p == '%')
> 
> > Don't we want %% to be %?
> 
> I looked at the spec, and this piece of code is right: there is nothing
> in the spec that says that %% means anything other than two string
> pattern matches (which of course has the same effect as one).  So I made
> gram.y agree.
> 
> It could be that people like Microsoft don't follow the spec... can
> anyone check this?

DoMatch, which implements LIKE clearly thinks %% is %, and I think our
users think so too.  I would not change it.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Mon, 7 Jun 1999 11:35:35 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [COMMITTERS] 'pgsql/src/backend/parser gram.y'
Bruce Momjian <maillist@candle.pha.pa.us> writes:
> DoMatch, which implements LIKE clearly thinks %% is %,

Careful: DoMatch thinks %% is a wildcard (ie, same as %), not literal %.

It's hard to say what our users think.  If you'd written %% it would
indeed match a % --- but you'd have a problem with it matching other
stuff too.  This might or might not be partially masked by the range
conditions inserted by the parser.  (But how long have we been doing
that?)

			regards, tom lane

Mon, 07 Jun 1999 13:28:26 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Re: [COMMITTERS] 'pgsql/src/backend/parser gram.y' 
> Bruce Momjian <maillist@candle.pha.pa.us> writes:
> > DoMatch, which implements LIKE clearly thinks %% is %,
> 
> Careful: DoMatch thinks %% is a wildcard (ie, same as %), not literal %.
> 
> It's hard to say what our users think.  If you'd written %% it would
> indeed match a % --- but you'd have a problem with it matching other
> stuff too.  This might or might not be partially masked by the range
> conditions inserted by the parser.  (But how long have we been doing
> that?)

Sorry.  I see now.  I was confused.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Mon, 7 Jun 1999 13:58:06 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Re: [COMMITTERS] 'pgsql/src/backend/parser gram.y'