mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Fixes: Using LIKE or ~ operator on text type files which are null valued
causes segmentation fault. Thanks to: Salvador Ortiz Garcia, Robert Patrick, Paul 'Shag' Walmsley, and James Cooper for finding and fixing the problem.
This commit is contained in:
@ -120,6 +120,7 @@ char16nlike(char *s, struct varlena *p)
|
|||||||
bool
|
bool
|
||||||
namelike(NameData *n, struct varlena *p)
|
namelike(NameData *n, struct varlena *p)
|
||||||
{
|
{
|
||||||
|
if (!n) return FALSE;
|
||||||
return (fixedlen_like(n->data, p, NAMEDATALEN));
|
return (fixedlen_like(n->data, p, NAMEDATALEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +133,7 @@ namenlike(NameData *s, struct varlena *p)
|
|||||||
bool
|
bool
|
||||||
textlike(struct varlena *s, struct varlena *p)
|
textlike(struct varlena *s, struct varlena *p)
|
||||||
{
|
{
|
||||||
|
if (!s) return FALSE;
|
||||||
return (fixedlen_like(VARDATA(s), p, VARSIZE(s) - VARHDRSZ));
|
return (fixedlen_like(VARDATA(s), p, VARSIZE(s) - VARHDRSZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +143,7 @@ bool textnlike(struct varlena *s, struct varlena *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Revision: 1.1.1.1 $
|
/* $Revision: 1.2 $
|
||||||
** "like.c" A first attempt at a LIKE operator for Postgres95.
|
** "like.c" A first attempt at a LIKE operator for Postgres95.
|
||||||
**
|
**
|
||||||
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
|
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.1.1.1 1996/07/09 06:22:05 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.2 1996/07/09 06:39:19 scrappy Exp $
|
||||||
*
|
*
|
||||||
* Alistair Crooks added the code for the regex caching
|
* Alistair Crooks added the code for the regex caching
|
||||||
* agc - cached the regular expressions used - there's a good chance
|
* agc - cached the regular expressions used - there's a good chance
|
||||||
@ -240,6 +240,7 @@ char16regexne(char *s, struct varlena *p)
|
|||||||
bool
|
bool
|
||||||
nameregexeq(NameData *n, struct varlena *p)
|
nameregexeq(NameData *n, struct varlena *p)
|
||||||
{
|
{
|
||||||
|
if (!n) return FALSE;
|
||||||
return (fixedlen_regexeq(n->data, p, NAMEDATALEN, REG_EXTENDED));
|
return (fixedlen_regexeq(n->data, p, NAMEDATALEN, REG_EXTENDED));
|
||||||
}
|
}
|
||||||
bool
|
bool
|
||||||
@ -251,6 +252,7 @@ nameregexne(NameData *s, struct varlena *p)
|
|||||||
bool
|
bool
|
||||||
textregexeq(struct varlena *s, struct varlena *p)
|
textregexeq(struct varlena *s, struct varlena *p)
|
||||||
{
|
{
|
||||||
|
if (!s) return (FALSE);
|
||||||
return (fixedlen_regexeq(VARDATA(s), p, VARSIZE(s) - VARHDRSZ, REG_EXTENDED));
|
return (fixedlen_regexeq(VARDATA(s), p, VARSIZE(s) - VARHDRSZ, REG_EXTENDED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,6 +321,7 @@ char16icregexne(char *s, struct varlena *p)
|
|||||||
bool
|
bool
|
||||||
texticregexeq(struct varlena *s, struct varlena *p)
|
texticregexeq(struct varlena *s, struct varlena *p)
|
||||||
{
|
{
|
||||||
|
if (!s) return FALSE;
|
||||||
return (fixedlen_regexeq(VARDATA(s), p, VARSIZE(s) - VARHDRSZ,
|
return (fixedlen_regexeq(VARDATA(s), p, VARSIZE(s) - VARHDRSZ,
|
||||||
REG_ICASE | REG_EXTENDED));
|
REG_ICASE | REG_EXTENDED));
|
||||||
}
|
}
|
||||||
@ -332,6 +335,7 @@ texticregexne(struct varlena *s, struct varlena *p)
|
|||||||
bool
|
bool
|
||||||
nameicregexeq(NameData *n, struct varlena *p)
|
nameicregexeq(NameData *n, struct varlena *p)
|
||||||
{
|
{
|
||||||
|
if (!n) return FALSE;
|
||||||
return (fixedlen_regexeq(n->data, p, NAMEDATALEN,
|
return (fixedlen_regexeq(n->data, p, NAMEDATALEN,
|
||||||
REG_ICASE | REG_EXTENDED));
|
REG_ICASE | REG_EXTENDED));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user