77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.68 1998/12/13 23:50:58 thomas Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.69 1998/12/14 05:18:37 scrappy Exp $
1111 *
1212 * INTERFACE ROUTINES
1313 *heap_create()- Create an uncataloged heap relation
@@ -244,7 +244,7 @@ heap_create(char *name,
244244
245245if (name [0 ]== '\0' )
246246{
247- sprintf (tempname ,"temp_%d" ,relid );
247+ snprintf (tempname , NAMEDATALEN ,"temp_%d" ,relid );
248248Assert (strlen (tempname )< NAMEDATALEN );
249249relname = tempname ;
250250isTemp = 1 ;
@@ -1448,8 +1448,9 @@ start:;
14481448/* Surround table name with double quotes to allow mixed-case and
14491449 * whitespaces in names. - BGA 1998-11-14
14501450 */
1451- sprintf (str ,"select %s%s from \"%.*s\"" ,attrdef -> adsrc ,cast ,
1452- NAMEDATALEN ,rel -> rd_rel -> relname .data );
1451+ snprintf (str ,MAX_PARSE_BUFFER ,
1452+ "select %s%s from \"%.*s\"" ,attrdef -> adsrc ,cast ,
1453+ NAMEDATALEN ,rel -> rd_rel -> relname .data );
14531454setheapoverride (true);
14541455planTree_list = (List * )pg_parse_and_plan (str ,NULL ,0 ,& queryTree_list ,None , FALSE);
14551456setheapoverride (false);
@@ -1463,22 +1464,6 @@ start:;
14631464expr = te -> expr ;
14641465type = exprType (expr );
14651466
1466- #if 0
1467- if (IsA (expr ,Const ))
1468- {
1469- if (((Const * )expr )-> consttype != atp -> atttypid )
1470- {
1471- if (* cast != 0 )
1472- elog (ERROR ,"DEFAULT: const type mismatched" );
1473- sprintf (cast ,":: %s" ,typeidTypeName (atp -> atttypid ));
1474- gotostart ;
1475- }
1476- }
1477- else if ((exprType (expr )!= atp -> atttypid )
1478- && !IS_BINARY_COMPATIBLE (exprType (expr ),atp -> atttypid ))
1479- elog (ERROR ,"DEFAULT: type mismatched" );
1480- #endif
1481-
14821467if (type != atp -> atttypid )
14831468{
14841469if (IS_BINARY_COMPATIBLE (type ,atp -> atttypid ))
@@ -1490,7 +1475,7 @@ start:;
14901475if (* cast != 0 )
14911476elog (ERROR ,"DEFAULT clause const type '%s' mismatched with column type '%s'" ,
14921477typeidTypeName (type ),typeidTypeName (atp -> atttypid ));
1493- sprintf (cast ,":: %s" ,typeidTypeName (atp -> atttypid ));
1478+ snprintf (cast , 2 * NAMEDATALEN ,":: %s" ,typeidTypeName (atp -> atttypid ));
14941479gotostart ;
14951480}
14961481else
@@ -1544,7 +1529,8 @@ StoreRelCheck(Relation rel, ConstrCheck *check)
15441529/* Check for table's existance. Surround table name with double-quotes
15451530 * to allow mixed-case and whitespace names. - thomas 1998-11-12
15461531 */
1547- sprintf (str ,"select 1 from \"%.*s\" where %s" ,
1532+ snprintf (str ,MAX_PARSE_BUFFER ,
1533+ "select 1 from \"%.*s\" where %s" ,
15481534NAMEDATALEN ,rel -> rd_rel -> relname .data ,check -> ccsrc );
15491535setheapoverride (true);
15501536planTree_list = (List * )pg_parse_and_plan (str ,NULL ,0 ,& queryTree_list ,None , FALSE);