aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/pg_operator.c16
-rw-r--r--src/backend/catalog/pg_proc.c14
-rw-r--r--src/backend/catalog/pg_type.c36
-rw-r--r--src/backend/commands/analyze.c6
-rw-r--r--src/backend/commands/command.c4
-rw-r--r--src/backend/optimizer/util/clauses.c40
-rw-r--r--src/include/c.h5
7 files changed, 65 insertions, 56 deletions
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index 5796b11b988..a0c6dd70a38 100644
--- a/src/backend/catalog/pg_operator.c
+++ b/src/backend/catalog/pg_operator.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.50 2000/05/28 17:55:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.51 2000/08/21 17:22:35 tgl Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -262,10 +262,10 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
namestrcpy(&oname, operatorName);
values[i++] = NameGetDatum(&oname);
values[i++] = Int32GetDatum(GetUserId());
- values[i++] = (Datum) (uint16) 0;
- values[i++] = (Datum) 'b'; /* assume it's binary */
- values[i++] = (Datum) (bool) 0;
- values[i++] = (Datum) (bool) 0;
+ values[i++] = UInt16GetDatum(0);
+ values[i++] = CharGetDatum('b'); /* assume it's binary */
+ values[i++] = BoolGetDatum(false);
+ values[i++] = BoolGetDatum(false);
values[i++] = ObjectIdGetDatum(leftObjectId); /* <-- left oid */
values[i++] = ObjectIdGetDatum(rightObjectId); /* <-- right oid */
values[i++] = ObjectIdGetDatum(InvalidOid);
@@ -648,9 +648,9 @@ OperatorDef(char *operatorName,
values[i++] = NameGetDatum(&oname);
values[i++] = Int32GetDatum(GetUserId());
values[i++] = UInt16GetDatum(precedence);
- values[i++] = leftTypeName ? (rightTypeName ? 'b' : 'r') : 'l';
- values[i++] = Int8GetDatum(isLeftAssociative);
- values[i++] = Int8GetDatum(canHash);
+ values[i++] = CharGetDatum(leftTypeName ? (rightTypeName ? 'b' : 'r') : 'l');
+ values[i++] = BoolGetDatum(isLeftAssociative);
+ values[i++] = BoolGetDatum(canHash);
values[i++] = ObjectIdGetDatum(leftTypeId);
values[i++] = ObjectIdGetDatum(rightTypeId);
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index 0322d982d16..ab6ce91e46d 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.46 2000/07/05 23:11:07 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.47 2000/08/21 17:22:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -295,14 +295,14 @@ ProcedureCreate(char *procedureName,
values[i++] = Int32GetDatum(GetUserId());
values[i++] = ObjectIdGetDatum(languageObjectId);
/* XXX isinherited is always false for now */
- values[i++] = Int8GetDatum((bool) false);
- values[i++] = Int8GetDatum(trusted);
- values[i++] = Int8GetDatum(canCache);
- values[i++] = Int8GetDatum(isStrict);
+ values[i++] = BoolGetDatum(false);
+ values[i++] = BoolGetDatum(trusted);
+ values[i++] = BoolGetDatum(canCache);
+ values[i++] = BoolGetDatum(isStrict);
values[i++] = UInt16GetDatum(parameterCount);
- values[i++] = Int8GetDatum(returnsSet);
+ values[i++] = BoolGetDatum(returnsSet);
values[i++] = ObjectIdGetDatum(typeObjectId);
- values[i++] = (Datum) typev;
+ values[i++] = PointerGetDatum(typev);
values[i++] = Int32GetDatum(byte_pct); /* probyte_pct */
values[i++] = Int32GetDatum(perbyte_cpu); /* properbyte_cpu */
values[i++] = Int32GetDatum(percall_cpu); /* propercall_cpu */
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index 8356958d325..2e5970cfcc8 100644
--- a/src/backend/catalog/pg_type.c
+++ b/src/backend/catalog/pg_type.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.54 2000/07/05 23:11:07 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.55 2000/08/21 17:22:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -177,17 +177,17 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
values[i++] = Int16GetDatum(0); /* 3 */
values[i++] = Int16GetDatum(0); /* 4 */
values[i++] = BoolGetDatum(false); /* 5 */
- values[i++] = BoolGetDatum(false); /* 6 */
+ values[i++] = CharGetDatum(0); /* 6 */
values[i++] = BoolGetDatum(false); /* 7 */
- values[i++] = BoolGetDatum(false); /* 8 */
+ values[i++] = CharGetDatum(0); /* 8 */
values[i++] = ObjectIdGetDatum(InvalidOid); /* 9 */
values[i++] = ObjectIdGetDatum(InvalidOid); /* 10 */
values[i++] = ObjectIdGetDatum(InvalidOid); /* 11 */
values[i++] = ObjectIdGetDatum(InvalidOid); /* 12 */
values[i++] = ObjectIdGetDatum(InvalidOid); /* 13 */
values[i++] = ObjectIdGetDatum(InvalidOid); /* 14 */
- values[i++] = CharGetDatum('p'); /* 15 */
- values[i++] = CharGetDatum('i'); /* 16 */
+ values[i++] = CharGetDatum('i'); /* 15 */
+ values[i++] = CharGetDatum('p'); /* 16 */
values[i++] = DirectFunctionCall1(textin,
CStringGetDatum(typeName)); /* 17 */
@@ -370,16 +370,16 @@ TypeCreate(char *typeName,
*/
i = 0;
namestrcpy(&name, typeName);
- values[i++] = NameGetDatum(&name); /* 1 */
- values[i++] = (Datum) GetUserId(); /* 2 */
- values[i++] = (Datum) internalSize; /* 3 */
- values[i++] = (Datum) externalSize; /* 4 */
- values[i++] = (Datum) passedByValue; /* 5 */
- values[i++] = (Datum) typeType; /* 6 */
- values[i++] = (Datum) (bool) 1; /* 7 */
- values[i++] = (Datum) typDelim; /* 8 */
- values[i++] = (Datum) (typeType == 'c' ? relationOid : InvalidOid); /* 9 */
- values[i++] = (Datum) elementObjectId; /* 10 */
+ values[i++] = NameGetDatum(&name); /* 1 */
+ values[i++] = Int32GetDatum(GetUserId()); /* 2 */
+ values[i++] = Int16GetDatum(internalSize); /* 3 */
+ values[i++] = Int16GetDatum(externalSize); /* 4 */
+ values[i++] = BoolGetDatum(passedByValue); /* 5 */
+ values[i++] = CharGetDatum(typeType); /* 6 */
+ values[i++] = BoolGetDatum(true); /* 7 */
+ values[i++] = CharGetDatum(typDelim); /* 8 */
+ values[i++] = ObjectIdGetDatum(typeType == 'c' ? relationOid : InvalidOid); /* 9 */
+ values[i++] = ObjectIdGetDatum(elementObjectId); /* 10 */
procs[0] = inputProcedure;
procs[1] = outputProcedure;
@@ -438,20 +438,20 @@ TypeCreate(char *typeName,
func_error("TypeCreate", procname, 1, argList, NULL);
}
- values[i++] = (Datum) tup->t_data->t_oid; /* 11 - 14 */
+ values[i++] = ObjectIdGetDatum(tup->t_data->t_oid); /* 11 - 14 */
}
/* ----------------
* set default alignment
* ----------------
*/
- values[i++] = (Datum) alignment; /* 15 */
+ values[i++] = CharGetDatum(alignment); /* 15 */
/* ----------------
* set default storage for TOAST
* ----------------
*/
- values[i++] = (Datum) storage; /* 16 */
+ values[i++] = CharGetDatum(storage); /* 16 */
/* ----------------
* initialize the default value for this type.
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 757003f8112..1747132f8a7 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.4 2000/08/06 04:40:08 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.5 2000/08/21 17:22:32 tgl Exp $
*
*-------------------------------------------------------------------------
@@ -436,8 +436,8 @@ update_attstats(Oid relid, int natts, VacAttrStats *vacattrstats)
if (VacAttrStatsEqValid(stats))
{
- float32data selratio; /* average ratio of rows selected
- * for a random constant */
+ float4 selratio; /* average ratio of rows selected
+ * for a random constant */
/* Compute disbursion */
if (stats->nonnull_cnt == 0 && stats->null_cnt == 0)
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c
index 68487f64ffc..13d0ad56497 100644
--- a/src/backend/commands/command.c
+++ b/src/backend/commands/command.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.94 2000/08/04 04:16:06 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.95 2000/08/21 17:22:32 tgl Exp $
*
* NOTES
* The PerformAddAttribute() code, like most of the relation
@@ -614,7 +614,7 @@ AlterTableAlterColumn(const char *relationName,
Int16GetDatum(attnum));
ScanKeyEntryInitialize(&scankeys[2], 0x0,
Anum_pg_attribute_atthasdef, F_BOOLEQ,
- Int32GetDatum(TRUE));
+ BoolGetDatum(true));
scan = heap_beginscan(attr_rel, false, SnapshotNow, 3, scankeys);
AssertState(scan != NULL);
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index 65e71456360..22d93b26e7b 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.71 2000/08/13 02:50:10 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.72 2000/08/21 17:22:34 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -353,7 +353,7 @@ make_ands_implicit(Expr *clause)
return clause->args;
else if (IsA(clause, Const) &&
!((Const *) clause)->constisnull &&
- DatumGetInt32(((Const *) clause)->constvalue))
+ DatumGetBool(((Const *) clause)->constvalue))
return NIL; /* constant TRUE input -> NIL list */
else
return lcons(clause, NIL);
@@ -1111,12 +1111,15 @@ eval_const_expressions_mutator(Node *node, void *context)
case OR_EXPR:
{
- /*
- * OR arguments are handled as follows: non constant:
- * keep FALSE: drop (does not affect result) TRUE:
- * force result to TRUE NULL: keep only one We keep
- * one NULL input because ExecEvalOr returns NULL when
- * no input is TRUE and at least one is NULL.
+ /*----------
+ * OR arguments are handled as follows:
+ * non constant: keep
+ * FALSE: drop (does not affect result)
+ * TRUE: force result to TRUE
+ * NULL: keep only one
+ * We keep one NULL input because ExecEvalOr returns NULL
+ * when no input is TRUE and at least one is NULL.
+ *----------
*/
List *newargs = NIL;
List *arg;
@@ -1133,7 +1136,7 @@ eval_const_expressions_mutator(Node *node, void *context)
const_input = (Const *) lfirst(arg);
if (const_input->constisnull)
haveNull = true;
- else if (DatumGetInt32(const_input->constvalue))
+ else if (DatumGetBool(const_input->constvalue))
forceTrue = true;
/* otherwise, we can drop the constant-false input */
}
@@ -1161,12 +1164,15 @@ eval_const_expressions_mutator(Node *node, void *context)
case AND_EXPR:
{
- /*
- * AND arguments are handled as follows: non constant:
- * keep TRUE: drop (does not affect result) FALSE:
- * force result to FALSE NULL: keep only one We keep
- * one NULL input because ExecEvalAnd returns NULL
+ /*----------
+ * AND arguments are handled as follows:
+ * non constant: keep
+ * TRUE: drop (does not affect result)
+ * FALSE: force result to FALSE
+ * NULL: keep only one
+ * We keep one NULL input because ExecEvalAnd returns NULL
* when no input is FALSE and at least one is NULL.
+ *----------
*/
List *newargs = NIL;
List *arg;
@@ -1183,7 +1189,7 @@ eval_const_expressions_mutator(Node *node, void *context)
const_input = (Const *) lfirst(arg);
if (const_input->constisnull)
haveNull = true;
- else if (!DatumGetInt32(const_input->constvalue))
+ else if (!DatumGetBool(const_input->constvalue))
forceFalse = true;
/* otherwise, we can drop the constant-true input */
}
@@ -1217,7 +1223,7 @@ eval_const_expressions_mutator(Node *node, void *context)
if (const_input->constisnull)
return MAKEBOOLCONST(false, true);
/* otherwise pretty easy */
- return MAKEBOOLCONST(!DatumGetInt32(const_input->constvalue),
+ return MAKEBOOLCONST(!DatumGetBool(const_input->constvalue),
false);
case SUBPLAN_EXPR:
@@ -1330,7 +1336,7 @@ eval_const_expressions_mutator(Node *node, void *context)
}
const_input = (Const *) casewhen->expr;
if (const_input->constisnull ||
- !DatumGetInt32(const_input->constvalue))
+ !DatumGetBool(const_input->constvalue))
continue; /* drop alternative with FALSE condition */
/*
diff --git a/src/include/c.h b/src/include/c.h
index 2cd807d98c5..8bdb40a58a7 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: c.h,v 1.80 2000/07/17 04:35:55 tgl Exp $
+ * $Id: c.h,v 1.81 2000/08/21 17:22:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -186,6 +186,9 @@ typedef unsigned int uint32; /* == 32 bits */
*
* Since sizeof(floatN) may be > sizeof(char *), always pass
* floatN by reference.
+ *
+ * XXX: these typedefs are now deprecated in favor of float4 and float8.
+ * They will eventually go away.
*/
typedef float float32data;
typedef double float64data;