*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.64 1997/11/10 15:22:36 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.65 1997/11/14 05:57:23 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
Node *result = NULL;
/* 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 &&
((A_Const *)rexpr)->val.type == T_String &&
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;
if (n->val.val.str[pos] == '\\')
pos++;
}
}
}
- 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)
{
if (nodeTag(rexpr) == T_A_Const &&
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.103 1997/11/13 03:36:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.104 1997/11/14 05:57:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
strcat(descbuf, "pg_attribute.attname = '");
strcat(descbuf, column);
strcat(descbuf, "' and ");
- strcat(descbuf, " pg_attribute.oid = pg_description.rowoid " );
+ strcat(descbuf, " pg_attribute.oid = pg_description.objoid " );
if (!(res = PSQLexec(pset, descbuf)))
return -1;
}
strcat(descbuf, "WHERE pg_class.relname = '");
strcat(descbuf, object);
strcat(descbuf, "'" );
- strcat(descbuf, " and pg_class.oid = pg_description.rowoid " );
+ strcat(descbuf, " and pg_class.oid = pg_description.objoid " );
if (!(res = PSQLexec(pset, descbuf)))
return -1;
else if (PQntuples(res) <= 0)
strcat(descbuf, "WHERE pg_type.typname = '");
strcat(descbuf, object);
strcat(descbuf, "'" );
- strcat(descbuf, " and pg_type.oid = pg_description.rowoid " );
+ strcat(descbuf, " and pg_type.oid = pg_description.objoid " );
if (!(res = PSQLexec(pset, descbuf)))
return -1;
else if (PQntuples(res) <= 0)
strcat(descbuf, "WHERE pg_type.typname = '");
strcat(descbuf, object);
strcat(descbuf, "'" );
- strcat(descbuf, " and pg_type.oid = pg_description.rowoid " );
+ strcat(descbuf, " and pg_type.oid = pg_description.objoid " );
if (!(res = PSQLexec(pset, descbuf)))
return -1;
else if (PQntuples(res) <= 0)
strcat(descbuf, "WHERE pg_proc.proname = '");
strcat(descbuf, object);
strcat(descbuf, "'" );
- strcat(descbuf, " and pg_proc.oid = pg_description.rowoid " );
+ strcat(descbuf, " and pg_proc.oid = pg_description.objoid " );
if (!(res = PSQLexec(pset, descbuf)))
return -1;
else if (PQntuples(res) <= 0)
strcat(descbuf, "WHERE pg_operator.oprname = '");
strcat(descbuf, object);
strcat(descbuf, "'" );
- strcat(descbuf, " and pg_operator.oid = pg_description.rowoid " );
+ strcat(descbuf, " and pg_operator.oid = pg_description.objoid " );
if (!(res = PSQLexec(pset, descbuf)))
return -1;
else if (PQntuples(res) <= 0)
strcat(descbuf, "WHERE pg_aggregate.aggname = '");
strcat(descbuf, object);
strcat(descbuf, "'" );
- strcat(descbuf, " and pg_aggregate.oid = pg_description.rowoid " );
+ strcat(descbuf, " and pg_aggregate.oid = pg_description.objoid " );
if (!(res = PSQLexec(pset, descbuf)))
return -1;
}
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#define AttrDefaultIndex "pg_attrdefind"
#define RelCheckIndex "pg_relcheckind"
#define TriggerRelidIndex "pg_trigrelidind"
-#define DescriptionRowOidIndex "pg_descrrowoidind"
+#define DescriptionObjOidIndex "pg_descrobjoidind"
extern char *Name_pg_attr_indices[];
extern char *Name_pg_proc_indices[];
extern char *Name_pg_attrdef_indices[];
extern char *Name_pg_relcheck_indices[];
extern char *Name_pg_trigger_indices[];
-extern char *Name_pg_rowoid_indices[];
+extern char *Name_pg_objoid_indices[];
extern char *IndexedCatalogNames[];
DECLARE_INDEX(pg_trigrelidind on pg_trigger using btree(tgrelid oid_ops));
-DECLARE_INDEX(pg_descrrowoidind on pg_description using btree(rowoid oid_ops));
+DECLARE_INDEX(pg_descrobjoidind on pg_description using btree(objoid oid_ops));
/* now build indices in the initialization scripts */
BUILD_INDICES
*
* 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
* the genbki.sh script reads this file and generates .bki
*/
CATALOG(pg_description)
{
- Oid rowoid;
+ Oid objoid;
text description;
} FormData_pg_description;
* ----------------
*/
#define Natts_pg_description 2
-#define Anum_pg_description_rowoid 1
+#define Anum_pg_description_objoid 1
#define Anum_pg_description_description 2
/* ----------------