for (i = 0; i < nargs;)
{
- text *seqname;
int attnum = SPI_fnumber(tupdesc, args[i]);
int32 val;
+ Datum seqname;
if (attnum < 0)
- elog(ERROR, "autoinc (%s): there is no attribute %s", relname, args[i]);
+ elog(ERROR, "autoinc (%s): there is no attribute %s",
+ relname, args[i]);
if (SPI_gettypeid(tupdesc, attnum) != INT4OID)
elog(ERROR, "autoinc (%s): attribute %s must be of INT4 type",
relname, args[i]);
i++;
chattrs[chnattrs] = attnum;
- seqname = textin(args[i]);
- newvals[chnattrs] = DirectFunctionCall1(nextval,
- PointerGetDatum(seqname));
+ seqname = DirectFunctionCall1(textin,
+ CStringGetDatum(args[i]));
+ newvals[chnattrs] = DirectFunctionCall1(nextval, seqname);
if (DatumGetInt32(newvals[chnattrs]) == 0)
- newvals[chnattrs] = DirectFunctionCall1(nextval,
- PointerGetDatum(seqname));
- pfree(seqname);
+ newvals[chnattrs] = DirectFunctionCall1(nextval, seqname);
+ pfree(DatumGetTextP(seqname));
chnattrs++;
i++;
}
relname, args[0]);
/* create fields containing name */
- newval = PointerGetDatum(textin(GetPgUserName()));
+ newval = DirectFunctionCall1(textin, CStringGetDatum(GetPgUserName()));
/* construct new tuple */
rettuple = SPI_modifytuple(rel, rettuple, 1, &attnum, &newval, NULL);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.138 2000/07/04 06:11:23 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.139 2000/07/05 23:11:06 tgl Exp $
*
*
* INTERFACE ROUTINES
/* If a valid where predicate, compute predicate Node */
if (VARSIZE(&index->indpred) != 0)
{
- predString = textout(&index->indpred);
+ predString = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&index->indpred)));
oldPred = stringToNode(predString);
pfree(predString);
}
values[Anum_pg_attrdef_adrelid - 1] = RelationGetRelid(rel);
values[Anum_pg_attrdef_adnum - 1] = attnum;
- values[Anum_pg_attrdef_adbin - 1] = PointerGetDatum(textin(adbin));
- values[Anum_pg_attrdef_adsrc - 1] = PointerGetDatum(textin(adsrc));
+ values[Anum_pg_attrdef_adbin - 1] = DirectFunctionCall1(textin,
+ CStringGetDatum(adbin));
+ values[Anum_pg_attrdef_adsrc - 1] = DirectFunctionCall1(textin,
+ CStringGetDatum(adsrc));
adrel = heap_openr(AttrDefaultRelationName, RowExclusiveLock);
tuple = heap_formtuple(adrel->rd_att, values, nulls);
heap_insert(adrel, tuple);
values[Anum_pg_relcheck_rcrelid - 1] = RelationGetRelid(rel);
values[Anum_pg_relcheck_rcname - 1] = PointerGetDatum(namein(ccname));
- values[Anum_pg_relcheck_rcbin - 1] = PointerGetDatum(textin(ccbin));
- values[Anum_pg_relcheck_rcsrc - 1] = PointerGetDatum(textin(ccsrc));
+ values[Anum_pg_relcheck_rcbin - 1] = DirectFunctionCall1(textin,
+ CStringGetDatum(ccbin));
+ values[Anum_pg_relcheck_rcsrc - 1] = DirectFunctionCall1(textin,
+ CStringGetDatum(ccsrc));
rcrel = heap_openr(RelCheckRelationName, RowExclusiveLock);
tuple = heap_formtuple(rcrel->rd_att, values, nulls);
heap_insert(rcrel, tuple);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.123 2000/07/05 16:17:37 wieck Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.124 2000/07/05 23:11:06 tgl Exp $
*
*
* INTERFACE ROUTINES
if (predicate != NULL)
{
predString = nodeToString(predicate);
- predText = textin(predString);
+ predText = DatumGetTextP(DirectFunctionCall1(textin,
+ CStringGetDatum(predString)));
pfree(predString);
}
else
- predText = textin("");
+ predText = DatumGetTextP(DirectFunctionCall1(textin,
+ CStringGetDatum("")));
predLen = VARSIZE(predText);
itupLen = predLen + sizeof(FormData_pg_index);
if (newPred != NULL)
{
predString = nodeToString(newPred);
- predText = textin(predString);
+ predText = DatumGetTextP(DirectFunctionCall1(textin,
+ CStringGetDatum(predString)));
pfree(predString);
}
else
- predText = textin("");
+ predText = DatumGetTextP(DirectFunctionCall1(textin,
+ CStringGetDatum("")));
/* open the index system catalog relation */
pg_index = heap_openr(IndexRelationName, RowExclusiveLock);
elog(ERROR, "IndexesAreActive couldn't lock %u", relid);
if (((Form_pg_class) GETSTRUCT(&tuple))->relkind != RELKIND_RELATION &&
((Form_pg_class) GETSTRUCT(&tuple))->relkind != RELKIND_TOASTVALUE)
- elog(ERROR, "relation %u isn't an relation", relid);
+ elog(ERROR, "relation %u isn't an indexable relation", relid);
isactive = ((Form_pg_class) GETSTRUCT(&tuple))->relhasindex;
ReleaseBuffer(buffer);
if (isactive)
/* If a valid where predicate, compute predicate Node */
if (VARSIZE(&index->indpred) != 0)
{
- predString = textout(&index->indpred);
+ predString = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&index->indpred)));
oldPred = stringToNode(predString);
pfree(predString);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.33 2000/05/30 04:24:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.34 2000/07/05 23:11:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
values[Anum_pg_aggregate_aggfinaltype - 1] = ObjectIdGetDatum(fret);
if (agginitval1)
- values[Anum_pg_aggregate_agginitval1 - 1] = PointerGetDatum(textin(agginitval1));
+ values[Anum_pg_aggregate_agginitval1 - 1] =
+ DirectFunctionCall1(textin, CStringGetDatum(agginitval1));
else
nulls[Anum_pg_aggregate_agginitval1 - 1] = 'n';
if (agginitval2)
- values[Anum_pg_aggregate_agginitval2 - 1] = PointerGetDatum(textin(agginitval2));
+ values[Anum_pg_aggregate_agginitval2 - 1] =
+ DirectFunctionCall1(textin, CStringGetDatum(agginitval2));
else
nulls[Anum_pg_aggregate_agginitval2 - 1] = 'n';
Oid transtype,
typinput,
typelem;
- text *textInitVal;
+ Datum textInitVal;
char *strInitVal;
Datum initVal;
initValAttno = Anum_pg_aggregate_agginitval2;
}
- textInitVal = (text *) fastgetattr(tup, initValAttno,
- RelationGetDescr(aggRel),
- isNull);
- if (!PointerIsValid(textInitVal))
- *isNull = true;
+ textInitVal = fastgetattr(tup, initValAttno,
+ RelationGetDescr(aggRel),
+ isNull);
if (*isNull)
{
heap_close(aggRel, AccessShareLock);
return PointerGetDatum(NULL);
}
- strInitVal = textout(textInitVal);
+ strInitVal = DatumGetCString(DirectFunctionCall1(textout, textInitVal));
heap_close(aggRel, AccessShareLock);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.45 2000/06/28 03:31:23 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.46 2000/07/05 23:11:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*/
text *prosrctext;
- prosrctext = textin(prosrc);
+ prosrctext = DatumGetTextP(DirectFunctionCall1(textin,
+ CStringGetDatum(prosrc)));
tup = SearchSysCacheTuple(PROSRC,
PointerGetDatum(prosrctext),
0, 0, 0);
values[i++] = Int32GetDatum(perbyte_cpu); /* properbyte_cpu */
values[i++] = Int32GetDatum(percall_cpu); /* propercall_cpu */
values[i++] = Int32GetDatum(outin_ratio); /* prooutin_ratio */
- values[i++] = (Datum) textin(prosrc); /* prosrc */
- values[i++] = (Datum) textin(probin); /* probin */
+ values[i++] = DirectFunctionCall1(textin, /* prosrc */
+ CStringGetDatum(prosrc));
+ values[i++] = DirectFunctionCall1(textin, /* probin */
+ CStringGetDatum(probin));
rel = heap_openr(ProcedureRelationName, RowExclusiveLock);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.53 2000/07/03 23:09:28 wieck Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.54 2000/07/05 23:11:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
/* ----------------
- * initialize *values with the type name and
+ * initialize *values with the type name and dummy values
* ----------------
*/
i = 0;
namestrcpy(&name, typeName);
- values[i++] = NameGetDatum(&name); /* 1 */
- values[i++] = (Datum) InvalidOid; /* 2 */
- values[i++] = (Datum) (int16) 0; /* 3 */
- values[i++] = (Datum) (int16) 0; /* 4 */
- values[i++] = (Datum) (bool) 0; /* 5 */
- values[i++] = (Datum) (bool) 0; /* 6 */
- values[i++] = (Datum) (bool) 0; /* 7 */
- values[i++] = (Datum) (bool) 0; /* 8 */
- values[i++] = (Datum) InvalidOid; /* 9 */
- values[i++] = (Datum) InvalidOid; /* 10 */
- values[i++] = (Datum) InvalidOid; /* 11 */
- values[i++] = (Datum) InvalidOid; /* 12 */
- values[i++] = (Datum) InvalidOid; /* 13 */
- values[i++] = (Datum) InvalidOid; /* 14 */
- values[i++] = (Datum) 'p'; /* 15 */
- values[i++] = (Datum) 'i'; /* 16 */
-
- /*
- * ... and fill typdefault with a bogus value
- */
- values[i++] = (Datum) textin(typeName); /* 15 */
+ values[i++] = NameGetDatum(&name); /* 1 */
+ values[i++] = ObjectIdGetDatum(InvalidOid); /* 2 */
+ values[i++] = Int16GetDatum(0); /* 3 */
+ values[i++] = Int16GetDatum(0); /* 4 */
+ values[i++] = BoolGetDatum(false); /* 5 */
+ values[i++] = BoolGetDatum(false); /* 6 */
+ values[i++] = BoolGetDatum(false); /* 7 */
+ values[i++] = BoolGetDatum(false); /* 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++] = DirectFunctionCall1(textin,
+ CStringGetDatum(typeName)); /* 17 */
/* ----------------
* create a new type tuple with FormHeapTuple
* initialize the default value for this type.
* ----------------
*/
- values[i] = (Datum) textin(PointerIsValid(defaultTypeValue) /* 17 */
- ? defaultTypeValue : "-"); /* XXX default
- * typdefault */
+ values[i] = DirectFunctionCall1(textin, /* 17 */
+ CStringGetDatum(defaultTypeValue ? defaultTypeValue : "-"));
/* ----------------
* open pg_type and begin a scan for the type name.
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.2 2000/05/30 04:25:00 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.3 2000/07/05 23:11:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
if (VacAttrStatsLtGtValid(stats) && stats->initialized)
{
- float32data nullratio;
- float32data bestratio;
+ float4 nullratio;
+ float4 bestratio;
FmgrInfo out_function;
char *out_string;
double best_cnt_d = stats->best_cnt,
values[i++] = ObjectIdGetDatum(relid); /* starelid */
values[i++] = Int16GetDatum(attp->attnum); /* staattnum */
values[i++] = ObjectIdGetDatum(stats->op_cmplt); /* staop */
- /* hack: this code knows float4 is pass-by-ref */
- values[i++] = Float32GetDatum(&nullratio); /* stanullfrac */
- values[i++] = Float32GetDatum(&bestratio); /* stacommonfrac */
+ values[i++] = Float4GetDatum(nullratio); /* stanullfrac */
+ values[i++] = Float4GetDatum(bestratio); /* stacommonfrac */
out_string = DatumGetCString(FunctionCall3(&out_function,
stats->best,
ObjectIdGetDatum(stats->typelem),
Int32GetDatum(stats->attr->atttypmod)));
- values[i++] = PointerGetDatum(textin(out_string)); /* stacommonval */
+ values[i++] = DirectFunctionCall1(textin, /* stacommonval */
+ CStringGetDatum(out_string));
pfree(out_string);
out_string = DatumGetCString(FunctionCall3(&out_function,
stats->min,
ObjectIdGetDatum(stats->typelem),
Int32GetDatum(stats->attr->atttypmod)));
- values[i++] = PointerGetDatum(textin(out_string)); /* staloval */
+ values[i++] = DirectFunctionCall1(textin, /* staloval */
+ CStringGetDatum(out_string));
pfree(out_string);
out_string = DatumGetCString(FunctionCall3(&out_function,
stats->max,
ObjectIdGetDatum(stats->typelem),
Int32GetDatum(stats->attr->atttypmod)));
- values[i++] = PointerGetDatum(textin(out_string)); /* stahival */
+ values[i++] = DirectFunctionCall1(textin, /* stahival */
+ CStringGetDatum(out_string));
pfree(out_string);
stup = heap_formtuple(sd->rd_att, values, nulls);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.87 2000/07/05 16:17:38 wieck Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.88 2000/07/05 23:11:09 tgl Exp $
*
* NOTES
* The PerformAddAttribute() code, like most of the relation
HeapTuple htup,
indexTuple;
Form_pg_index index;
- Form_pg_relcheck relcheck;
Form_pg_class pgcform = (Form_pg_class) NULL;
int i;
bool checkok = true;
while (HeapTupleIsValid(htup = systable_getnext(sysscan)))
{
+ Form_pg_relcheck relcheck;
char *ccbin;
Node *node;
relcheck = (Form_pg_relcheck) GETSTRUCT(htup);
- ccbin = textout(&relcheck->rcbin);
- if (!ccbin)
- continue;
+ ccbin = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&relcheck->rcbin)));
node = stringToNode(ccbin);
pfree(ccbin);
if (find_attribute_in_node(node, attnum))
BYTEAOID,
-1, 0, false);
- /* XXX what if owning relation is temp? need we mark toasttable too? */
- /* XXX How do we know? No naming collisions possible because names */
- /* are OID based. And toast table disappears when master table */
- /* is destroyed. So what is it good for anyway? Jan */
+ /*
+ * Note: the toast relation is considered a "normal" relation even if
+ * its master relation is a temp table. There cannot be any naming
+ * collision, and the toast rel will be destroyed when its master is,
+ * so there's no need to handle the toast rel as temp.
+ */
heap_create_with_catalog(toast_relname, tupdesc, RELKIND_TOASTVALUE,
false, true);
heap_freetuple(reltup);
/*
- * Close relatons and make changes visible
+ * Close relations and make changes visible
*/
heap_close(class_rel, NoLock);
heap_close(rel, NoLock);
}
i = 0;
values[i++] = ObjectIdGetDatum(oid);
- values[i++] = (Datum) textin(comment);
+ values[i++] = DirectFunctionCall1(textin, CStringGetDatum(comment));
}
/*** Now, open pg_description and attempt to find the old tuple ***/
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.116 2000/06/28 06:05:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.117 2000/07/05 23:11:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
indexNatts[i] = natts;
if (VARSIZE(&pgIndexP[i]->indpred) != 0)
{
- predString = textout(&pgIndexP[i]->indpred);
+ predString = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&pgIndexP[i]->indpred)));
indexPred[i] = stringToNode(predString);
pfree(predString);
/* make dummy ExprContext for use by ExecQual */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.57 2000/06/02 04:04:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.58 2000/07/05 23:11:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
new_record[Anum_pg_database_datname - 1] = NameGetDatum(namein(dbname));
new_record[Anum_pg_database_datdba - 1] = Int32GetDatum(user_id);
new_record[Anum_pg_database_encoding - 1] = Int32GetDatum(encoding);
- new_record[Anum_pg_database_datpath - 1] = PointerGetDatum(textin(locbuf));
+ new_record[Anum_pg_database_datpath - 1] = DirectFunctionCall1(textin,
+ CStringGetDatum(locbuf));
tuple = heap_formtuple(pg_database_dsc, new_record, new_record_nulls);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.33 2000/07/04 06:11:27 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.34 2000/07/05 23:11:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
char *predString;
- predString = textout(&index->indpred);
+ predString = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&index->indpred)));
oldPred = stringToNode(predString);
pfree(predString);
}
i = 0;
values[i++] = PointerGetDatum(languageName);
- values[i++] = Int8GetDatum((bool) 1);
- values[i++] = Int8GetDatum(stmt->pltrusted);
+ values[i++] = BoolGetDatum(true); /* lanispl */
+ values[i++] = BoolGetDatum(stmt->pltrusted);
values[i++] = ObjectIdGetDatum(procTup->t_data->t_oid);
- values[i++] = (Datum) textin(stmt->plcompiler);
+ values[i++] = DirectFunctionCall1(textin,
+ CStringGetDatum(stmt->plcompiler));
rel = heap_openr(LanguageRelationName, RowExclusiveLock);
static char *
get_seq_name(text *seqin)
{
- char *rawname = textout(seqin);
+ char *rawname = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(seqin)));
int rawlen = strlen(rawname);
char *seqname;
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.62 2000/06/28 03:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.63 2000/07/05 23:11:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
CRYPT_PWD_FILE_SEPSTR
"%s\n",
nameout(DatumGetName(datum_n)),
- null_p ? "" : textout((text *) datum_p),
+ null_p ? "" :
+ DatumGetCString(DirectFunctionCall1(textout, datum_p)),
null_v ? "\\N" :
DatumGetCString(DirectFunctionCall1(nabstimeout, datum_v))
);
new_record[Anum_pg_shadow_usecatupd - 1] = (Datum) (stmt->createuser);
if (stmt->password)
- new_record[Anum_pg_shadow_passwd - 1] = PointerGetDatum(textin(stmt->password));
+ new_record[Anum_pg_shadow_passwd - 1] =
+ DirectFunctionCall1(textin, CStringGetDatum(stmt->password));
if (stmt->validUntil)
new_record[Anum_pg_shadow_valuntil - 1] =
DirectFunctionCall1(nabstimein, CStringGetDatum(stmt->validUntil));
/* password */
if (stmt->password)
{
- new_record[Anum_pg_shadow_passwd - 1] = PointerGetDatum(textin(stmt->password));
+ new_record[Anum_pg_shadow_passwd - 1] =
+ DirectFunctionCall1(textin, CStringGetDatum(stmt->password));
new_record_nulls[Anum_pg_shadow_passwd - 1] = ' ';
}
else
{
/* leave as is */
- new_record[Anum_pg_shadow_passwd - 1] = heap_getattr(tuple, Anum_pg_shadow_passwd, pg_shadow_dsc, &null);
+ new_record[Anum_pg_shadow_passwd - 1] =
+ heap_getattr(tuple, Anum_pg_shadow_passwd, pg_shadow_dsc, &null);
new_record_nulls[Anum_pg_shadow_passwd - 1] = null ? 'n' : ' ';
}
else
{
/* leave as is */
- new_record[Anum_pg_shadow_valuntil - 1] = heap_getattr(tuple, Anum_pg_shadow_valuntil, pg_shadow_dsc, &null);
+ new_record[Anum_pg_shadow_valuntil - 1] =
+ heap_getattr(tuple, Anum_pg_shadow_valuntil, pg_shadow_dsc, &null);
new_record_nulls[Anum_pg_shadow_valuntil - 1] = null ? 'n' : ' ';
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.61 2000/06/19 23:40:47 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.62 2000/07/05 23:11:14 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
char *predString;
- predString = textout(&indexStruct->indpred);
+ predString = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&indexStruct->indpred)));
predicate = (PredInfo *) stringToNode(predString);
pfree(predString);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.34 2000/07/04 06:11:37 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.35 2000/07/05 23:11:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
else
{
pqargs[k].len = VAR_LENGTH_ARG;
- pqargs[k].u.ptr = (int *) textin(fields[j]);
+ pqargs[k].u.ptr = (int *)
+ DatumGetTextP(DirectFunctionCall1(textin,
+ CStringGetDatum(fields[j])));
printf("pqtest_PQfn: arg %d is text %s\n", k, fields[j]); /* debug */
}
}
* get the query
* ----------------
*/
- q = textout(vlena);
- if (q == NULL)
- return -1;
+ q = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(vlena)));
switch (q[0])
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.85 2000/05/30 00:49:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.86 2000/07/05 23:11:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
case OID_VARCHAR_LIKE_OP:
case OID_NAME_LIKE_OP:
/* the right-hand const is type text for all of these */
- patt = textout((text *) DatumGetPointer(constvalue));
+ patt = DatumGetCString(DirectFunctionCall1(textout,
+ constvalue));
isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Like,
&prefix, &rest) != Pattern_Prefix_None;
if (prefix)
case OID_VARCHAR_REGEXEQ_OP:
case OID_NAME_REGEXEQ_OP:
/* the right-hand const is type text for all of these */
- patt = textout((text *) DatumGetPointer(constvalue));
+ patt = DatumGetCString(DirectFunctionCall1(textout,
+ constvalue));
isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Regex,
&prefix, &rest) != Pattern_Prefix_None;
if (prefix)
case OID_VARCHAR_ICREGEXEQ_OP:
case OID_NAME_ICREGEXEQ_OP:
/* the right-hand const is type text for all of these */
- patt = textout((text *) DatumGetPointer(constvalue));
+ patt = DatumGetCString(DirectFunctionCall1(textout,
+ constvalue));
isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Regex_IC,
&prefix, &rest) != Pattern_Prefix_None;
if (prefix)
case OID_NAME_LIKE_OP:
/* the right-hand const is type text for all of these */
constvalue = ((Const *) rightop)->constvalue;
- patt = textout((text *) DatumGetPointer(constvalue));
+ patt = DatumGetCString(DirectFunctionCall1(textout,
+ constvalue));
pstatus = pattern_fixed_prefix(patt, Pattern_Type_Like,
&prefix, &rest);
resultquals = nconc(resultquals,
case OID_NAME_REGEXEQ_OP:
/* the right-hand const is type text for all of these */
constvalue = ((Const *) rightop)->constvalue;
- patt = textout((text *) DatumGetPointer(constvalue));
+ patt = DatumGetCString(DirectFunctionCall1(textout,
+ constvalue));
pstatus = pattern_fixed_prefix(patt, Pattern_Type_Regex,
&prefix, &rest);
resultquals = nconc(resultquals,
case OID_NAME_ICREGEXEQ_OP:
/* the right-hand const is type text for all of these */
constvalue = ((Const *) rightop)->constvalue;
- patt = textout((text *) DatumGetPointer(constvalue));
+ patt = DatumGetCString(DirectFunctionCall1(textout,
+ constvalue));
pstatus = pattern_fixed_prefix(patt, Pattern_Type_Regex_IC,
&prefix, &rest);
resultquals = nconc(resultquals,
static Datum
string_to_datum(const char *str, Oid datatype)
{
-
/*
* We cheat a little by assuming that textin() will do for bpchar and
* varchar constants too...
if (datatype == NAMEOID)
return PointerGetDatum(namein((char *) str));
else
- return PointerGetDatum(textin((char *) str));
+ return DirectFunctionCall1(textin, CStringGetDatum(str));
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.58 2000/06/20 04:22:14 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.59 2000/07/05 23:11:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
info->indproc = index->indproc; /* functional index ?? */
if (VARSIZE(&index->indpred) != 0) /* partial index ?? */
{
- char *predString = textout(&index->indpred);
+ char *predString;
+ predString = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&index->indpred)));
info->indpred = (List *) stringToNode(predString);
pfree(predString);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.44 2000/06/15 03:32:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.45 2000/07/05 23:11:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
if (!con->constisnull)
{
/* We know the source constant is really of type 'text' */
- char *val = textout((text *) con->constvalue);
+ char *val = DatumGetCString(DirectFunctionCall1(textout,
+ con->constvalue));
newcon->constvalue = stringTypeDatum(targetType, val, atttypmod);
pfree(val);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.42 2000/06/14 18:17:36 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.43 2000/07/05 23:11:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
break;
case T_String:
- val = PointerGetDatum(textin(strVal(value)));
+ val = DirectFunctionCall1(textin, CStringGetDatum(strVal(value)));
typeid = UNKNOWNOID;/* will be coerced later */
typelen = -1; /* variable len */
/* -----------------------------------------------------------------------
* formatting.c
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.18 2000/07/03 23:09:50 wieck Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.19 2000/07/05 23:11:35 tgl Exp $
*
*
* Portions Copyright (c) 1999-2000, PostgreSQL, Inc
len = VARSIZE(fmt) - VARHDRSZ;
- if ((!len) || (TIMESTAMP_NOT_FINITE(dt)))
- return PointerGetDatum(textin(""));
+ if (len <= 0 || TIMESTAMP_NOT_FINITE(dt))
+ return DirectFunctionCall1(textin, CStringGetDatum(""));
ZERO_tm(tm);
tzn = NULL;
#define NUM_TOCHAR_prepare \
do { \
len = VARSIZE(fmt) - VARHDRSZ; \
- \
if (len <= 0) \
- return PointerGetDatum(textin("")); \
- \
+ return DirectFunctionCall1(textin, CStringGetDatum("")); \
result = (text *) palloc( (len * NUM_MAX_ITEM_SIZ) + 1 + VARHDRSZ); \
format = NUM_cache(len, &Num, VARDATA(fmt), &flag); \
-} while(0)
+} while (0)
/* ----------
* MACRO: Finish part of NUM
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.30 2000/01/26 05:57:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.31 2000/07/05 23:11:35 tgl Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
char *re;
int regcomp_result;
- re = textout(text_re);
+ re = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(text_re)));
/* find a previously compiled regular expression */
for (i = 0; i < rec; i++)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.73 2000/06/15 03:32:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.74 2000/07/05 23:11:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/* the right-hand const is type text for all supported operators */
Assert(rtype == TEXTOID);
- patt = textout((text *) DatumGetPointer(value));
+ patt = DatumGetCString(DirectFunctionCall1(textout, value));
/* divide pattern into fixed prefix and remainder */
pstatus = pattern_fixed_prefix(patt, ptype, &prefix, &rest);
*/
if (commonval)
{
- text *val = (text *) SysCacheGetAttr(STATRELID, tuple,
+ Datum val = SysCacheGetAttr(STATRELID, tuple,
Anum_pg_statistic_stacommonval,
- &isnull);
+ &isnull);
if (isnull)
{
}
else
{
- char *strval = textout(val);
+ char *strval = DatumGetCString(DirectFunctionCall1(textout,
+ val));
*commonval = FunctionCall3(&inputproc,
CStringGetDatum(strval),
if (loval)
{
- text *val = (text *) SysCacheGetAttr(STATRELID, tuple,
- Anum_pg_statistic_staloval,
- &isnull);
+ Datum val = SysCacheGetAttr(STATRELID, tuple,
+ Anum_pg_statistic_staloval,
+ &isnull);
if (isnull)
{
}
else
{
- char *strval = textout(val);
+ char *strval = DatumGetCString(DirectFunctionCall1(textout,
+ val));
*loval = FunctionCall3(&inputproc,
CStringGetDatum(strval),
if (hival)
{
- text *val = (text *) SysCacheGetAttr(STATRELID, tuple,
- Anum_pg_statistic_stahival,
- &isnull);
+ Datum val = SysCacheGetAttr(STATRELID, tuple,
+ Anum_pg_statistic_stahival,
+ &isnull);
if (isnull)
{
}
else
{
- char *strval = textout(val);
+ char *strval = DatumGetCString(DirectFunctionCall1(textout,
+ val));
*hival = FunctionCall3(&inputproc,
CStringGetDatum(strval),
static Datum
string_to_datum(const char *str, Oid datatype)
{
-
/*
* We cheat a little by assuming that textin() will do for bpchar and
* varchar constants too...
if (datatype == NAMEOID)
return PointerGetDatum(namein((char *) str));
else
- return PointerGetDatum(textin((char *) str));
+ return DirectFunctionCall1(textin, CStringGetDatum(str));
}
/*-------------------------------------------------------------------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.20 2000/06/09 01:11:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.21 2000/07/05 23:11:35 tgl Exp $
*
* NOTES
* input routine largely stolen from boxin().
}
#endif
-#ifdef NOT_USED
-text *
-tid_text(ItemPointer tid)
-{
- char *str;
-
- if (!tid)
- return (text *) NULL;
- str = tidout(tid);
-
- return textin(str);
-} /* tid_text() */
-#endif
-
-#ifdef NOT_USED
-ItemPointer
-text_tid(const text *string)
-{
- ItemPointer result;
- char *str;
-
- if (!string)
- return (ItemPointer) 0;
-
- str = textout((text *) string);
- result = tidin(str);
- pfree(str);
-
- return result;
-} /* text_tid() */
-#endif
-
/*
* Functions to get latest tid of a specified tuple.
*
char *str;
Relation rel;
- str = textout(relname);
+ str = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(relname)));
result = (ItemPointer) palloc(sizeof(ItemPointerData));
ItemPointerSetInvalid(result);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.31 2000/07/03 23:09:53 wieck Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.32 2000/07/05 23:11:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*tm = &tt;
if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- elog(ERROR, "Interval units '%s' not recognized", textout(units));
+ elog(ERROR, "Interval units '%s' not recognized",
+ DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(units))));
up = VARDATA(units);
lp = lowunits;
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
result = (Interval *) palloc(sizeof(Interval));
if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- elog(ERROR, "Interval units '%s' not recognized", textout(units));
+ elog(ERROR, "Interval units '%s' not recognized",
+ DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(units))));
up = VARDATA(units);
lp = lowunits;
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
#endif
else
{
- elog(ERROR, "Interval units '%s' not recognized", textout(units));
+ elog(ERROR, "Interval units '%s' not recognized",
+ DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(units))));
PG_RETURN_NULL();
}
*tm = &tt;
if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- elog(ERROR, "Interval units '%s' not recognized", textout(units));
+ elog(ERROR, "Interval units '%s' not recognized",
+ DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(units))));
up = VARDATA(units);
lp = lowunits;
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
*tm = &tt;
if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- elog(ERROR, "Interval units '%s' not recognized", textout(units));
+ elog(ERROR, "Interval units '%s' not recognized",
+ DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(units))));
up = VARDATA(units);
lp = lowunits;
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
default:
elog(ERROR, "Interval units '%s' not yet supported",
- textout(units));
+ DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(units))));
result = 0;
}
}
else
{
- elog(ERROR, "Interval units '%s' not recognized", textout(units));
+ elog(ERROR, "Interval units '%s' not recognized",
+ DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(units))));
result = 0;
}
int len;
if (VARSIZE(zone) - VARHDRSZ > MAXDATELEN)
- elog(ERROR, "Time zone '%s' not recognized", textout(zone));
+ elog(ERROR, "Time zone '%s' not recognized",
+ DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(zone))));
up = VARDATA(zone);
lp = lowzone;
for (i = 0; i < (VARSIZE(zone) - VARHDRSZ); i++)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.61 2000/07/03 23:09:54 wieck Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.62 2000/07/05 23:11:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/*
* textin - converts "..." to internal representation
*/
-text *
-textin(char *inputText)
+Datum
+textin(PG_FUNCTION_ARGS)
{
+ char *inputText = PG_GETARG_CSTRING(0);
text *result;
int len;
- if (inputText == NULL)
- return NULL;
-
len = strlen(inputText) + VARHDRSZ;
result = (text *) palloc(len);
VARATT_SIZEP(result) = len;
- memmove(VARDATA(result), inputText, len - VARHDRSZ);
+ memcpy(VARDATA(result), inputText, len - VARHDRSZ);
#ifdef CYR_RECODE
convertstr(VARDATA(result), len - VARHDRSZ, 0);
#endif
- return result;
+ PG_RETURN_TEXT_P(result);
}
/*
* textout - converts internal representation to "..."
*/
-char *
-textout(text *vlena)
+Datum
+textout(PG_FUNCTION_ARGS)
{
+ text *t = PG_GETARG_TEXT_P(0);
int len;
char *result;
- if (vlena == NULL)
- {
- result = (char *) palloc(2);
- result[0] = '-';
- result[1] = '\0';
- return result;
- }
- len = VARSIZE(vlena) - VARHDRSZ;
+ len = VARSIZE(t) - VARHDRSZ;
result = (char *) palloc(len + 1);
- memmove(result, VARDATA(vlena), len);
+ memcpy(result, VARDATA(t), len);
result[len] = '\0';
#ifdef CYR_RECODE
convertstr(result, len, 1);
#endif
- return result;
+ PG_RETURN_CSTRING(result);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.32 2000/06/06 17:44:25 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.33 2000/07/05 23:11:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
Form_pg_type typeStruct;
FunctionCachePtr retval;
int nargs;
- text *tmp;
+ Datum tmp;
bool isNull;
retval = (FunctionCachePtr) palloc(sizeof(FunctionCache));
if (procedureStruct->prolang == SQLlanguageId)
{
- tmp = (text *) SysCacheGetAttr(PROCOID,
- procedureTuple,
- Anum_pg_proc_prosrc,
- &isNull);
+ tmp = SysCacheGetAttr(PROCOID,
+ procedureTuple,
+ Anum_pg_proc_prosrc,
+ &isNull);
if (isNull)
elog(ERROR, "init_fcache: null prosrc for procedure %u",
foid);
- retval->src = textout(tmp);
+ retval->src = DatumGetCString(DirectFunctionCall1(textout, tmp));
retval->bin = (char *) NULL;
}
else
retval->bin = (char *) NULL;
else
{
- tmp = (text *) SysCacheGetAttr(PROCOID,
- procedureTuple,
- Anum_pg_proc_probin,
- &isNull);
+ tmp = SysCacheGetAttr(PROCOID,
+ procedureTuple,
+ Anum_pg_proc_probin,
+ &isNull);
if (isNull)
elog(ERROR, "init_fcache: null probin for procedure %u",
foid);
- retval->bin = textout(tmp);
+ retval->bin = DatumGetCString(DirectFunctionCall1(textout, tmp));
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.105 2000/06/30 07:04:10 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.106 2000/07/05 23:11:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
IndexScanDesc sd = (IndexScanDesc) NULL;
HeapScanDesc adscan = (HeapScanDesc) NULL;
RetrieveIndexResult indexRes;
- struct varlena *val;
+ Datum val;
bool isnull;
int found;
int i;
NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
RelationGetRelationName(relation));
- val = (struct varlena *) fastgetattr(htup,
- Anum_pg_attrdef_adbin,
- adrel->rd_att, &isnull);
+ val = fastgetattr(htup,
+ Anum_pg_attrdef_adbin,
+ adrel->rd_att, &isnull);
if (isnull)
elog(NOTICE, "AttrDefaultFetch: adbin IS NULL for attr %s in rel %s",
NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
RelationGetRelationName(relation));
else
attrdef[i].adbin = MemoryContextStrdup(CacheMemoryContext,
- textout(val));
+ DatumGetCString(DirectFunctionCall1(textout,
+ val)));
break;
}
if (hasindex)
HeapScanDesc rcscan = (HeapScanDesc) NULL;
RetrieveIndexResult indexRes;
Name rcname;
- struct varlena *val;
+ Datum val;
bool isnull;
int found;
bool hasindex;
RelationGetRelationName(relation));
check[found].ccname = MemoryContextStrdup(CacheMemoryContext,
NameStr(*rcname));
- val = (struct varlena *) fastgetattr(htup,
- Anum_pg_relcheck_rcbin,
- rcrel->rd_att, &isnull);
+ val = fastgetattr(htup,
+ Anum_pg_relcheck_rcbin,
+ rcrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "RelCheckFetch: rcbin IS NULL for rel %s",
RelationGetRelationName(relation));
check[found].ccbin = MemoryContextStrdup(CacheMemoryContext,
- textout(val));
+ DatumGetCString(DirectFunctionCall1(textout,
+ val)));
found++;
if (hasindex)
ReleaseBuffer(buffer);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.43 2000/06/28 03:32:31 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.44 2000/07/05 23:11:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
prosrcattr = SysCacheGetAttr(PROCOID, procedureTuple,
Anum_pg_proc_prosrc, &isnull);
- if (isnull || !PointerIsValid(prosrcattr))
- {
+ if (isnull)
elog(ERROR, "fmgr: Could not extract prosrc for %u from pg_proc",
functionId);
- }
- prosrcstring = textout((text *) DatumGetPointer(prosrcattr));
+ prosrcstring = DatumGetCString(DirectFunctionCall1(textout, prosrcattr));
probinattr = SysCacheGetAttr(PROCOID, procedureTuple,
Anum_pg_proc_probin, &isnull);
- if (isnull || !PointerIsValid(probinattr))
- {
+ if (isnull)
elog(ERROR, "fmgr: Could not extract probin for %u from pg_proc",
functionId);
- }
- probinstring = textout((text *) DatumGetPointer(probinattr));
+ probinstring = DatumGetCString(DirectFunctionCall1(textout, probinattr));
user_fn = load_external_function(probinstring, prosrcstring);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.43 2000/06/05 07:28:55 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.44 2000/07/05 23:11:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* stored in prosrc (it doesn't have to be the same as the
* name of the alias!)
*/
- prosrc = textout(&(procedureStruct->prosrc));
+ prosrc = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&procedureStruct->prosrc)));
fbp = fmgr_lookupByName(prosrc);
if (fbp == NULL)
elog(ERROR, "fmgr_info: function %s not in internal table",
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_proc.h,v 1.141 2000/06/19 03:54:45 tgl Exp $
+ * $Id: pg_proc.h,v 1.142 2000/07/05 23:11:45 tgl Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
DESCR("(internal)");
DATA(insert OID = 45 ( regprocout PGUID 12 f t f t 1 f 23 "0" 100 0 0 100 regprocout - ));
DESCR("(internal)");
-DATA(insert OID = 46 ( textin PGUID 11 f t t t 1 f 25 "0" 100 0 0 100 textin - ));
+DATA(insert OID = 46 ( textin PGUID 12 f t t t 1 f 25 "0" 100 0 0 100 textin - ));
DESCR("(internal)");
-DATA(insert OID = 47 ( textout PGUID 11 f t t t 1 f 23 "0" 100 0 0 100 textout - ));
+DATA(insert OID = 47 ( textout PGUID 12 f t t t 1 f 23 "0" 100 0 0 100 textout - ));
DESCR("(internal)");
DATA(insert OID = 48 ( tidin PGUID 11 f t t t 1 f 27 "0" 100 0 0 100 tidin - ));
DESCR("(internal)");
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: builtins.h,v 1.118 2000/06/19 03:54:48 tgl Exp $
+ * $Id: builtins.h,v 1.119 2000/07/05 23:11:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
extern int32 varcharoctetlen(char *arg);
/* varlena.c */
-extern text *textin(char *inputText);
-extern char *textout(text *vlena);
+extern Datum textin(PG_FUNCTION_ARGS);
+extern Datum textout(PG_FUNCTION_ARGS);
extern text *textcat(text *arg1, text *arg2);
extern bool texteq(text *arg1, text *arg2);
extern bool textne(text *arg1, text *arg2);
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.11 2000/06/05 07:29:11 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.12 2000/07/05 23:11:55 tgl Exp $
*
**********************************************************************/
* through the reference.
*
************************************************************/
- proc_source = textout(&(procStruct->prosrc));
-
+ proc_source = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&procStruct->prosrc)));
/************************************************************
* Create the procedure in the interpreter
"}\n"
"unset i v\n\n", -1);
- proc_source = textout(&(procStruct->prosrc));
+ proc_source = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&procStruct->prosrc)));
Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
pfree(proc_source);
Tcl_DStringAppendElement(&proc_internal_def,
* procedural language
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.20 2000/05/11 04:00:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.21 2000/07/05 23:11:58 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
* ----------
*/
procStruct = (Form_pg_proc) GETSTRUCT(procTup);
- proc_source = textout(&(procStruct->prosrc));
+ proc_source = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&procStruct->prosrc)));
plpgsql_setinput(proc_source, functype);
plpgsql_error_funcname = nameout(&(procStruct->proname));
plpgsql_error_lineno = 0;
* procedural language
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.23 2000/05/30 04:24:58 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.24 2000/07/05 23:11:58 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
rec_new->tupdesc = trigdata->tg_relation->rd_att;
rec_old->tup = NULL;
rec_old->tupdesc = NULL;
- var->value = (Datum) textin("INSERT");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("INSERT"));
}
else if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
{
rec_new->tupdesc = trigdata->tg_relation->rd_att;
rec_old->tup = trigdata->tg_trigtuple;
rec_old->tupdesc = trigdata->tg_relation->rd_att;
- var->value = (Datum) textin("UPDATE");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("UPDATE"));
}
else if (TRIGGER_FIRED_BY_DELETE(trigdata->tg_event))
{
rec_new->tupdesc = NULL;
rec_old->tup = trigdata->tg_trigtuple;
rec_old->tupdesc = trigdata->tg_relation->rd_att;
- var->value = (Datum) textin("DELETE");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("DELETE"));
}
else
{
rec_new->tup = NULL;
rec_new->tupdesc = NULL;
- var->value = (Datum) textin("UNKNOWN");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("UNKNOWN"));
}
/* ----------
var = (PLpgSQL_var *) (estate.datums[func->tg_when_varno]);
var->isnull = false;
if (TRIGGER_FIRED_BEFORE(trigdata->tg_event))
- var->value = (Datum) textin("BEFORE");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("BEFORE"));
else if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
- var->value = (Datum) textin("AFTER");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("AFTER"));
else
- var->value = (Datum) textin("UNKNOWN");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("UNKNOWN"));
var = (PLpgSQL_var *) (estate.datums[func->tg_level_varno]);
var->isnull = false;
if (TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
- var->value = (Datum) textin("ROW");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("ROW"));
else if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
- var->value = (Datum) textin("STATEMENT");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("STATEMENT"));
else
- var->value = (Datum) textin("UNKNOWN");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("UNKNOWN"));
var = (PLpgSQL_var *) (estate.datums[func->tg_relid_varno]);
var->isnull = false;
{
estate.trig_argv = palloc(sizeof(Datum) * estate.trig_nargs);
for (i = 0; i < trigdata->tg_trigger->tgnargs; i++)
- estate.trig_argv[i] = (Datum) textin(trigdata->tg_trigger->tgargs[i]);
+ estate.trig_argv[i] = DirectFunctionCall1(textin,
+ CStringGetDatum(trigdata->tg_trigger->tgargs[i]));
}
/* ----------
if (value < 0 || value >= estate->trig_nargs)
extval = "<OUT_OF_RANGE>";
else
- extval = textout((text *) (estate->trig_argv[value]));
+ extval = DatumGetCString(DirectFunctionCall1(textout,
+ estate->trig_argv[value]));
}
plpgsql_dstring_append(&ds, extval);
}
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.26 2000/06/05 07:29:13 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.27 2000/07/05 23:12:03 tgl Exp $
*
**********************************************************************/
sprintf(buf, "array set %d $__PLTcl_Tup_%d\n", i + 1, i + 1);
Tcl_DStringAppend(&proc_internal_body, buf, -1);
}
- proc_source = textout(&(procStruct->prosrc));
+ proc_source = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&procStruct->prosrc)));
Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
pfree(proc_source);
Tcl_DStringAppendElement(&proc_internal_def,
"}\n"
"unset i v\n\n", -1);
- proc_source = textout(&(procStruct->prosrc));
+ proc_source = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&procStruct->prosrc)));
Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
pfree(proc_source);
Tcl_DStringAppendElement(&proc_internal_def,
/*
- * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.40 2000/06/13 07:35:34 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.41 2000/07/05 23:12:09 tgl Exp $
*/
#include <float.h> /* faked on sunos */
}
{
- text *seqname = textin("ttdummy_seq");
+ text *seqname = DatumGetTextP(DirectFunctionCall1(textin,
+ CStringGetDatum("ttdummy_seq")));
newoff = DirectFunctionCall1(nextval,
PointerGetDatum(seqname));