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

Re: [HACKERS] SQL92

From: "Jose' Soares" <jose(at)sferacarta(dot)com>
To: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
Cc: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>, PostgreSQL Hackers Mailing List <pgsql-hackers(at)hub(dot)org>
Subject: Re: [HACKERS] SQL92
Date: 1998-09-30 10:14:12
Message-ID: 36120474.AF8FAF34@sferacarta.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Jackson, DeJuan wrote:
> 
> > > Does the SQL92 standard have to be purchased from the ANSI Board?
> >
> > afaik, yes.
> >
> > > Well, my actual question has to do with LIKE.  Could anyone who has
> > a
> > > copy of a standard send me the PATTERN syntax/meanings for LIKE in
> > > SQL92?
> >
> > Well, you may be hoping for more than is in any of your reference
> > books,
> > but there isn't any more to tell :)
> >
> >   % ==> match any (sub)string
> >   _ ==> match any single character
> >   everything else matches itself
> >
> > In SQL92 (but not yet in Postgres; can't remember if there is a
> > workaround):
> >
> >   LIKE 'pattern' ESCAPE 'char'
> >
> > allows a single character "char" if it precedes the two pattern
> > matching
> > characters to demote the "%" or "_" to act like a normal single
> > character. The Postgres regex stuff is much more powerful.
> >
> > Sorry, I think that's it :(
> >
> >                     - Tom
> Well, In all of the major Databases that I have worked with there is
> also the "[character_set]" matching operator.
> So a pattern of '[A-D]%' would match all word beginning with "A", "B",
> "C", or "D", and "[^character_set]" matches everything but the set.
> Looking at the current PgSQL like code this is ignored as well as the
> ESCAPE syntax.  I'm trying to resolve the problem we have of LIKE not
> matching the pattern "%%" to anything even "%".
> But, looking at the code I see that "%%" or "%%%%%%%%" should be equal
> to "%" so it's not the LIKE matching code that's causing the problem
> (also, read I'm looking in the wrong spot).
> 
> Does anybody know if the "[character_set]" stuff is part of the
> standard?
The SQL92 LIKE:

    character-string-expression [NOT] LIKE pattern [ESCAPE
'escape-char']
    
allows only the special characters % and _

You need The SQL3 SIMILAR

    character-string-expression [NOT] SIMILAR TO pattern [ESCAPE
'escape-char']

in this case pattern can involve additional special characters, not just
% and _ as in LIKE, but every regular expression or "[character_set]"
like you said. (Refer to "A Guide to SQL Standard 4th edition
Date-Rarwen, page 505).

     Jose'

In response to

Responses

pgsql-hackers by date

Next:From: Joost KraaijeveldDate: 1998-09-30 13:47:13
Subject: initdb question
Previous:From: Joost KraaijeveldDate: 1998-09-30 08:02:00
Subject: Windows NT port: what file are created by initdb?

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