aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/copy.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/copy.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/copy.c')
-rw-r--r--src/backend/commands/copy.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 69a059631bc..4d6fd988d77 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.299 2008/05/12 20:01:59 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.300 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1638,7 +1638,7 @@ CopyFrom(CopyState cstate)
int i;
Oid in_func_oid;
Datum *values;
- char *nulls;
+ bool *nulls;
int nfields;
char **field_strings;
bool done = false;
@@ -1872,7 +1872,7 @@ CopyFrom(CopyState cstate)
}
values = (Datum *) palloc(num_phys_attrs * sizeof(Datum));
- nulls = (char *) palloc(num_phys_attrs * sizeof(char));
+ nulls = (bool *) palloc(num_phys_attrs * sizeof(bool));
/* create workspace for CopyReadAttributes results */
nfields = file_has_oids ? (attr_count + 1) : attr_count;
@@ -1916,7 +1916,7 @@ CopyFrom(CopyState cstate)
/* Initialize all values for row to NULL */
MemSet(values, 0, num_phys_attrs * sizeof(Datum));
- MemSet(nulls, 'n', num_phys_attrs * sizeof(char));
+ MemSet(nulls, true, num_phys_attrs * sizeof(bool));
if (!cstate->binary)
{
@@ -1998,7 +1998,7 @@ CopyFrom(CopyState cstate)
typioparams[m],
attr[m]->atttypmod);
if (string != NULL)
- nulls[m] = ' ';
+ nulls[m] = false;
cstate->cur_attname = NULL;
cstate->cur_attval = NULL;
}
@@ -2054,8 +2054,7 @@ CopyFrom(CopyState cstate)
&in_functions[m],
typioparams[m],
attr[m]->atttypmod,
- &isnull);
- nulls[m] = isnull ? 'n' : ' ';
+ &nulls[m]);
cstate->cur_attname = NULL;
}
}
@@ -2068,13 +2067,11 @@ CopyFrom(CopyState cstate)
for (i = 0; i < num_defaults; i++)
{
values[defmap[i]] = ExecEvalExpr(defexprs[i], econtext,
- &isnull, NULL);
- if (!isnull)
- nulls[defmap[i]] = ' ';
+ &nulls[defmap[i]], NULL);
}
/* And now we can form the input tuple. */
- tuple = heap_formtuple(tupDesc, values, nulls);
+ tuple = heap_form_tuple(tupDesc, values, nulls);
if (cstate->oids && file_has_oids)
HeapTupleSetOid(tuple, loaded_oid);