88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.246 2005/06/28 05:08:53 tgl Exp $
11+ * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.247 2005/07/10 21:13:58 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -144,7 +144,7 @@ static char *CopyReadAttributeCSV(const char *delim, const char *null_print,
144144char * quote ,char * escape ,
145145CopyReadResult * result ,bool * isnull );
146146static Datum CopyReadBinaryAttribute (int column_no ,FmgrInfo * flinfo ,
147- Oid typioparam ,bool * isnull );
147+ Oid typioparam ,int32 typmod , bool * isnull );
148148static void CopyAttributeOut (char * string ,char * delim );
149149static void CopyAttributeOutCSV (char * string ,char * delim ,char * quote ,
150150char * escape ,bool force_quote );
@@ -1843,8 +1843,9 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
18431843copy_attname = "oid" ;
18441844loaded_oid =
18451845DatumGetObjectId (CopyReadBinaryAttribute (0 ,
1846- & oid_in_function ,
1847- oid_typioparam ,
1846+ & oid_in_function ,
1847+ oid_typioparam ,
1848+ -1 ,
18481849& isnull ));
18491850if (isnull || loaded_oid == InvalidOid )
18501851ereport (ERROR ,
@@ -1864,6 +1865,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
18641865values [m ]= CopyReadBinaryAttribute (i ,
18651866& in_functions [m ],
18661867typioparams [m ],
1868+ attr [m ]-> atttypmod ,
18671869& isnull );
18681870nulls [m ]= isnull ?'n' :' ' ;
18691871copy_attname = NULL ;
@@ -2556,7 +2558,8 @@ CopyReadAttributeCSV(const char *delim, const char *null_print, char *quote,
25562558 * Read a binary attribute
25572559 */
25582560static Datum
2559- CopyReadBinaryAttribute (int column_no ,FmgrInfo * flinfo ,Oid typioparam ,
2561+ CopyReadBinaryAttribute (int column_no ,FmgrInfo * flinfo ,
2562+ Oid typioparam ,int32 typmod ,
25602563bool * isnull )
25612564{
25622565int32 fld_size ;
@@ -2594,9 +2597,10 @@ CopyReadBinaryAttribute(int column_no, FmgrInfo *flinfo, Oid typioparam,
25942597attribute_buf .data [fld_size ]= '\0' ;
25952598
25962599/* Call the column type's binary input converter */
2597- result = FunctionCall2 (flinfo ,
2600+ result = FunctionCall3 (flinfo ,
25982601PointerGetDatum (& attribute_buf ),
2599- ObjectIdGetDatum (typioparam ));
2602+ ObjectIdGetDatum (typioparam ),
2603+ Int32GetDatum (typmod ));
26002604
26012605/* Trouble if it didn't eat the whole buffer */
26022606if (attribute_buf .cursor != attribute_buf .len )