aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/typecmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-11-02 01:45:28 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-11-02 01:45:28 +0000
commit902d1cb35f69464e1e13015b9e05abdb76a7444d (patch)
tree995e1ec29c8a937a3890956065a31c1ab9d7c6bd /src/backend/commands/typecmds.c
parent492059dabae9643f097fcd0a4f8860366563843d (diff)
downloadpostgresql-902d1cb35f69464e1e13015b9e05abdb76a7444d.tar.gz
postgresql-902d1cb35f69464e1e13015b9e05abdb76a7444d.zip
Remove all uses of the deprecated functions heap_formtuple, heap_modifytuple,
and heap_deformtuple in favor of the newer functions heap_form_tuple et al (which do the same things but use bool control flags instead of arbitrary char values). Eliminate the former duplicate coding of these functions, reducing the deprecated functions to mere wrappers around the newer ones. We can't get rid of them entirely because add-on modules probably still contain many instances of the old coding style. Kris Jurka
Diffstat (limited to 'src/backend/commands/typecmds.c')
-rw-r--r--src/backend/commands/typecmds.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index f985df6298b..2ea9021a9ba 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.125 2008/10/21 10:38:51 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.126 2008/11/02 01:45:28 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -1436,8 +1436,8 @@ AlterDomainDefault(List *names, Node *defaultRaw)
char *defaultValue;
Node *defaultExpr = NULL; /* NULL if no default specified */
Datum new_record[Natts_pg_type];
- char new_record_nulls[Natts_pg_type];
- char new_record_repl[Natts_pg_type];
+ bool new_record_nulls[Natts_pg_type];
+ bool new_record_repl[Natts_pg_type];
HeapTuple newtuple;
Form_pg_type typTup;
@@ -1460,8 +1460,8 @@ AlterDomainDefault(List *names, Node *defaultRaw)
/* Setup new tuple */
MemSet(new_record, (Datum) 0, sizeof(new_record));
- MemSet(new_record_nulls, ' ', sizeof(new_record_nulls));
- MemSet(new_record_repl, ' ', sizeof(new_record_repl));
+ MemSet(new_record_nulls, false, sizeof(new_record_nulls));
+ MemSet(new_record_repl, false, sizeof(new_record_repl));
/* Store the new default into the tuple */
if (defaultRaw)
@@ -1487,10 +1487,10 @@ AlterDomainDefault(List *names, Node *defaultRaw)
(IsA(defaultExpr, Const) &&((Const *) defaultExpr)->constisnull))
{
/* Default is NULL, drop it */
- new_record_nulls[Anum_pg_type_typdefaultbin - 1] = 'n';
- new_record_repl[Anum_pg_type_typdefaultbin - 1] = 'r';
- new_record_nulls[Anum_pg_type_typdefault - 1] = 'n';
- new_record_repl[Anum_pg_type_typdefault - 1] = 'r';
+ new_record_nulls[Anum_pg_type_typdefaultbin - 1] = true;
+ new_record_repl[Anum_pg_type_typdefaultbin - 1] = true;
+ new_record_nulls[Anum_pg_type_typdefault - 1] = true;
+ new_record_repl[Anum_pg_type_typdefault - 1] = true;
}
else
{
@@ -1509,21 +1509,21 @@ AlterDomainDefault(List *names, Node *defaultRaw)
*/
new_record[Anum_pg_type_typdefaultbin - 1] = CStringGetTextDatum(nodeToString(defaultExpr));
- new_record_repl[Anum_pg_type_typdefaultbin - 1] = 'r';
+ new_record_repl[Anum_pg_type_typdefaultbin - 1] = true;
new_record[Anum_pg_type_typdefault - 1] = CStringGetTextDatum(defaultValue);
- new_record_repl[Anum_pg_type_typdefault - 1] = 'r';
+ new_record_repl[Anum_pg_type_typdefault - 1] = true;
}
}
else
{
/* ALTER ... DROP DEFAULT */
- new_record_nulls[Anum_pg_type_typdefaultbin - 1] = 'n';
- new_record_repl[Anum_pg_type_typdefaultbin - 1] = 'r';
- new_record_nulls[Anum_pg_type_typdefault - 1] = 'n';
- new_record_repl[Anum_pg_type_typdefault - 1] = 'r';
+ new_record_nulls[Anum_pg_type_typdefaultbin - 1] = true;
+ new_record_repl[Anum_pg_type_typdefaultbin - 1] = true;
+ new_record_nulls[Anum_pg_type_typdefault - 1] = true;
+ new_record_repl[Anum_pg_type_typdefault - 1] = true;
}
- newtuple = heap_modifytuple(tup, RelationGetDescr(rel),
+ newtuple = heap_modify_tuple(tup, RelationGetDescr(rel),
new_record, new_record_nulls,
new_record_repl);