Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
ea4223c4
Commit
ea4223c4
authored
Nov 14, 1997
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIx for indexing regex stuff. Change rowoid to objoid.
parent
145bae27
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
83 deletions
+20
-83
src/backend/parser/gram.y
src/backend/parser/gram.y
+5
-68
src/bin/psql/psql.c
src/bin/psql/psql.c
+8
-8
src/include/catalog/indexing.h
src/include/catalog/indexing.h
+4
-4
src/include/catalog/pg_description.h
src/include/catalog/pg_description.h
+3
-3
No files found.
src/backend/parser/gram.y
View file @
ea4223c4
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.6
4 1997/11/10 15:22:36 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.6
5 1997/11/14 05:57:23 momjian
Exp $
*
*
* HISTORY
* HISTORY
* AUTHOR DATE MAJOR EVENT
* AUTHOR DATE MAJOR EVENT
...
@@ -3552,7 +3552,8 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr)
...
@@ -3552,7 +3552,8 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr)
Node *result = NULL;
Node *result = NULL;
/* we do this so indexes can be used */
/* we do this so indexes can be used */
if (strcmp(opname,"~") == 0)
if (strcmp(opname,"~") == 0 ||
strcmp(opname,"~*") == 0)
{
{
if (nodeTag(rexpr) == T_A_Const &&
if (nodeTag(rexpr) == T_A_Const &&
((A_Const *)rexpr)->val.type == T_String &&
((A_Const *)rexpr)->val.type == T_String &&
...
@@ -3570,7 +3571,8 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr)
...
@@ -3570,7 +3571,8 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr)
n->val.val.str[pos] == '?' ||
n->val.val.str[pos] == '?' ||
n->val.val.str[pos] == '*' ||
n->val.val.str[pos] == '*' ||
n->val.val.str[pos] == '[' ||
n->val.val.str[pos] == '[' ||
n->val.val.str[pos] == '$')
n->val.val.str[pos] == '$' ||
(strcmp(opname,"~*") == 0 && isalpha(n->val.val.str[pos]))
break;
break;
if (n->val.val.str[pos] == '\\')
if (n->val.val.str[pos] == '\\')
pos++;
pos++;
...
@@ -3599,71 +3601,6 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr)
...
@@ -3599,71 +3601,6 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr)
}
}
}
}
}
}
else if (strcmp(opname,"~*") == 0)
{
if (nodeTag(rexpr) == T_A_Const &&
((A_Const *)rexpr)->val.type == T_String &&
((A_Const *)rexpr)->val.val.str[0] == '^')
{
A_Const *n = (A_Const *)rexpr;
char *match_lower_least = palloc(strlen(n->val.val.str)+2);
char *match_lower_most = palloc(strlen(n->val.val.str)+2);
char *match_upper_least = palloc(strlen(n->val.val.str)+2);
char *match_upper_most = palloc(strlen(n->val.val.str)+2);
int pos, match_pos=0;
/* skip leading ^ */
for (pos = 1; n->val.val.str[pos]; pos++)
{
if (n->val.val.str[pos] == '.' ||
n->val.val.str[pos] == '?' ||
n->val.val.str[pos] == '*' ||
n->val.val.str[pos] == '[' ||
n->val.val.str[pos] == '$')
break;
if (n->val.val.str[pos] == '\\')
pos++;
/* If we have punctuation, this works well */
match_lower_least[match_pos] = tolower(n->val.val.str[pos]);
match_lower_most[match_pos] = tolower(n->val.val.str[pos]);
match_upper_least[match_pos] = toupper(n->val.val.str[pos]);
match_upper_most[match_pos++] = toupper(n->val.val.str[pos]);
}
if (match_pos != 0)
{
A_Const *lower_least = makeNode(A_Const);
A_Const *lower_most = makeNode(A_Const);
A_Const *upper_least = makeNode(A_Const);
A_Const *upper_most = makeNode(A_Const);
/* make strings to be used in index use */
match_lower_least[match_pos] = '\0';
match_lower_most[match_pos] = '\377';
match_lower_most[match_pos+1] = '\0';
match_upper_least[match_pos] = '\0';
match_upper_most[match_pos] = '\377';
match_upper_most[match_pos+1] = '\0';
lower_least->val.type = T_String;
lower_least->val.val.str = match_lower_least;
lower_most->val.type = T_String;
lower_most->val.val.str = match_lower_most;
upper_least->val.type = T_String;
upper_least->val.val.str = match_upper_least;
upper_most->val.type = T_String;
upper_most->val.val.str = match_upper_most;
result = makeA_Expr(AND, NULL,
makeA_Expr(OP, "~*", lexpr, rexpr),
makeA_Expr(OR, NULL,
makeA_Expr(AND, NULL,
makeA_Expr(OP, ">=", lexpr, (Node *)lower_least),
makeA_Expr(OP, "<=", lexpr, (Node *)lower_most)),
makeA_Expr(AND, NULL,
makeA_Expr(OP, ">=", lexpr, (Node *)upper_least),
makeA_Expr(OP, "<=", lexpr, (Node *)upper_most))));
}
}
}
else if (strcmp(opname,"~~") == 0)
else if (strcmp(opname,"~~") == 0)
{
{
if (nodeTag(rexpr) == T_A_Const &&
if (nodeTag(rexpr) == T_A_Const &&
...
...
src/bin/psql/psql.c
View file @
ea4223c4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.10
3 1997/11/13 03:36:30
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.10
4 1997/11/14 05:57:35
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -729,7 +729,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
...
@@ -729,7 +729,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat
(
descbuf
,
"pg_attribute.attname = '"
);
strcat
(
descbuf
,
"pg_attribute.attname = '"
);
strcat
(
descbuf
,
column
);
strcat
(
descbuf
,
column
);
strcat
(
descbuf
,
"' and "
);
strcat
(
descbuf
,
"' and "
);
strcat
(
descbuf
,
" pg_attribute.oid = pg_description.
row
oid "
);
strcat
(
descbuf
,
" pg_attribute.oid = pg_description.
obj
oid "
);
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
return
-
1
;
return
-
1
;
}
}
...
@@ -740,7 +740,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
...
@@ -740,7 +740,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat
(
descbuf
,
"WHERE pg_class.relname = '"
);
strcat
(
descbuf
,
"WHERE pg_class.relname = '"
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
" and pg_class.oid = pg_description.
row
oid "
);
strcat
(
descbuf
,
" and pg_class.oid = pg_description.
obj
oid "
);
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
return
-
1
;
return
-
1
;
else
if
(
PQntuples
(
res
)
<=
0
)
else
if
(
PQntuples
(
res
)
<=
0
)
...
@@ -752,7 +752,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
...
@@ -752,7 +752,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat
(
descbuf
,
"WHERE pg_type.typname = '"
);
strcat
(
descbuf
,
"WHERE pg_type.typname = '"
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
" and pg_type.oid = pg_description.
row
oid "
);
strcat
(
descbuf
,
" and pg_type.oid = pg_description.
obj
oid "
);
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
return
-
1
;
return
-
1
;
else
if
(
PQntuples
(
res
)
<=
0
)
else
if
(
PQntuples
(
res
)
<=
0
)
...
@@ -764,7 +764,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
...
@@ -764,7 +764,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat
(
descbuf
,
"WHERE pg_type.typname = '"
);
strcat
(
descbuf
,
"WHERE pg_type.typname = '"
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
" and pg_type.oid = pg_description.
row
oid "
);
strcat
(
descbuf
,
" and pg_type.oid = pg_description.
obj
oid "
);
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
return
-
1
;
return
-
1
;
else
if
(
PQntuples
(
res
)
<=
0
)
else
if
(
PQntuples
(
res
)
<=
0
)
...
@@ -776,7 +776,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
...
@@ -776,7 +776,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat
(
descbuf
,
"WHERE pg_proc.proname = '"
);
strcat
(
descbuf
,
"WHERE pg_proc.proname = '"
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
" and pg_proc.oid = pg_description.
row
oid "
);
strcat
(
descbuf
,
" and pg_proc.oid = pg_description.
obj
oid "
);
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
return
-
1
;
return
-
1
;
else
if
(
PQntuples
(
res
)
<=
0
)
else
if
(
PQntuples
(
res
)
<=
0
)
...
@@ -788,7 +788,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
...
@@ -788,7 +788,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat
(
descbuf
,
"WHERE pg_operator.oprname = '"
);
strcat
(
descbuf
,
"WHERE pg_operator.oprname = '"
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
" and pg_operator.oid = pg_description.
row
oid "
);
strcat
(
descbuf
,
" and pg_operator.oid = pg_description.
obj
oid "
);
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
return
-
1
;
return
-
1
;
else
if
(
PQntuples
(
res
)
<=
0
)
else
if
(
PQntuples
(
res
)
<=
0
)
...
@@ -800,7 +800,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
...
@@ -800,7 +800,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat
(
descbuf
,
"WHERE pg_aggregate.aggname = '"
);
strcat
(
descbuf
,
"WHERE pg_aggregate.aggname = '"
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
object
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
"'"
);
strcat
(
descbuf
,
" and pg_aggregate.oid = pg_description.
row
oid "
);
strcat
(
descbuf
,
" and pg_aggregate.oid = pg_description.
obj
oid "
);
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
if
(
!
(
res
=
PSQLexec
(
pset
,
descbuf
)))
return
-
1
;
return
-
1
;
}
}
...
...
src/include/catalog/indexing.h
View file @
ea4223c4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: indexing.h,v 1.
8 1997/11/13 03:22:54
momjian Exp $
* $Id: indexing.h,v 1.
9 1997/11/14 05:57:42
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
#define AttrDefaultIndex "pg_attrdefind"
#define AttrDefaultIndex "pg_attrdefind"
#define RelCheckIndex "pg_relcheckind"
#define RelCheckIndex "pg_relcheckind"
#define TriggerRelidIndex "pg_trigrelidind"
#define TriggerRelidIndex "pg_trigrelidind"
#define Description
RowOidIndex "pg_descrrow
oidind"
#define Description
ObjOidIndex "pg_descrobj
oidind"
extern
char
*
Name_pg_attr_indices
[];
extern
char
*
Name_pg_attr_indices
[];
extern
char
*
Name_pg_proc_indices
[];
extern
char
*
Name_pg_proc_indices
[];
...
@@ -55,7 +55,7 @@ extern char *Name_pg_class_indices[];
...
@@ -55,7 +55,7 @@ extern char *Name_pg_class_indices[];
extern
char
*
Name_pg_attrdef_indices
[];
extern
char
*
Name_pg_attrdef_indices
[];
extern
char
*
Name_pg_relcheck_indices
[];
extern
char
*
Name_pg_relcheck_indices
[];
extern
char
*
Name_pg_trigger_indices
[];
extern
char
*
Name_pg_trigger_indices
[];
extern
char
*
Name_pg_
row
oid_indices
[];
extern
char
*
Name_pg_
obj
oid_indices
[];
extern
char
*
IndexedCatalogNames
[];
extern
char
*
IndexedCatalogNames
[];
...
@@ -119,7 +119,7 @@ DECLARE_INDEX(pg_relcheckind on pg_relcheck using btree(rcrelid oid_ops));
...
@@ -119,7 +119,7 @@ DECLARE_INDEX(pg_relcheckind on pg_relcheck using btree(rcrelid oid_ops));
DECLARE_INDEX
(
pg_trigrelidind
on
pg_trigger
using
btree
(
tgrelid
oid_ops
));
DECLARE_INDEX
(
pg_trigrelidind
on
pg_trigger
using
btree
(
tgrelid
oid_ops
));
DECLARE_INDEX
(
pg_descr
rowoidind
on
pg_description
using
btree
(
row
oid
oid_ops
));
DECLARE_INDEX
(
pg_descr
objoidind
on
pg_description
using
btree
(
obj
oid
oid_ops
));
/* now build indices in the initialization scripts */
/* now build indices in the initialization scripts */
BUILD_INDICES
BUILD_INDICES
...
...
src/include/catalog/pg_description.h
View file @
ea4223c4
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: pg_description.h,v 1.
1 1997/11/13 03:22:59
momjian Exp $
* $Id: pg_description.h,v 1.
2 1997/11/14 05:57:46
momjian Exp $
*
*
* NOTES
* NOTES
* the genbki.sh script reads this file and generates .bki
* the genbki.sh script reads this file and generates .bki
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
*/
*/
CATALOG
(
pg_description
)
CATALOG
(
pg_description
)
{
{
Oid
row
oid
;
Oid
obj
oid
;
text
description
;
text
description
;
}
FormData_pg_description
;
}
FormData_pg_description
;
...
@@ -50,7 +50,7 @@ typedef FormData_pg_description *Form_pg_description;
...
@@ -50,7 +50,7 @@ typedef FormData_pg_description *Form_pg_description;
* ----------------
* ----------------
*/
*/
#define Natts_pg_description 2
#define Natts_pg_description 2
#define Anum_pg_description_
row
oid 1
#define Anum_pg_description_
obj
oid 1
#define Anum_pg_description_description 2
#define Anum_pg_description_description 2
/* ----------------
/* ----------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment