*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/Attic/stats.c,v 1.15 1999/02/13 23:14:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/Attic/stats.c,v 1.16 1999/07/03 00:32:36 momjian Exp $
*
* NOTES
* initam should be moved someplace else.
*/
#include <stdio.h>
+#include <time.h>
#include <postgres.h>
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.79 1999/06/19 04:54:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.80 1999/07/03 00:32:38 momjian Exp $
*
*
* INTERFACE ROUTINES
#include "postgres.h"
#include "access/genam.h"
+#include "access/htup.h"
#include "access/heapam.h"
#include "access/istrat.h"
#include "access/xact.h"
/*
* macros used in guessing how many tuples are on a page.
*/
-#define AVG_TUPLE_SIZE 8
+#define AVG_TUPLE_SIZE MinTupleSize
#define NTUPLES_PER_PAGE(natts) (BLCKSZ/((natts)*AVG_TUPLE_SIZE))
/* non-export function prototypes */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.80 1999/06/12 20:41:25 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.81 1999/07/03 00:32:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
}
-#define EXT_ATTLEN 5*BLCKSZ
+#define EXT_ATTLEN (5 * BLCKSZ)
/*
returns 1 is c is in s
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.109 1999/06/11 09:35:08 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.110 1999/07/03 00:32:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
empty_end_pages;
Size free_size,
usable_free_size;
- Size min_tlen = MAXTUPLEN;
+ Size min_tlen = MaxTupleSize;
Size max_tlen = 0;
int32 i;
struct rusage ru0,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/xfunc.c,v 1.4 1999/05/25 22:41:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/xfunc.c,v 1.5 1999/07/03 00:32:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
+#include "access/htup.h"
#include "access/heapam.h"
#include "catalog/pg_language.h"
#include "catalog/pg_proc.h"
RelOptInfo outerrel = get_parent((Path) get_outerjoinpath(joinnode));
RelOptInfo innerrel = get_parent((Path) get_innerjoinpath(joinnode));
Count outerwidth = get_width(outerrel);
- Count outers_per_page = ceil(BLCKSZ / (outerwidth + sizeof(HeapTupleData)));
+ Count outers_per_page = ceil(BLCKSZ / (outerwidth + MinTupleSize));
if (IsA(joinnode, HashPath))
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.84 1999/06/07 14:28:25 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.85 1999/07/03 00:32:44 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
#include <ctype.h>
#include "postgres.h"
+#include "access/htup.h"
#include "nodes/parsenodes.h"
#include "nodes/print.h"
#include "parser/gramparse.h"
if ($3 < 1)
elog(ERROR,"length for '%s' type must be at least 1",$1);
- else if ($3 > BLCKSZ - 128)
- elog(ERROR,"length for type '%s' cannot exceed %d",$1, BLCKSZ-128);
+ else if ($3 > MaxTupleSize)
+ elog(ERROR,"length for type '%s' cannot exceed %d",$1,
+ MaxTupleSize);
/* we actually implement this sort of like a varlen, so
* the first 4 bytes is the length. (the difference
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.22 1999/05/25 16:11:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.23 1999/07/03 00:32:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Assert(pageSize == BLCKSZ);
Assert(pageSize >
- specialSize + sizeof(PageHeaderData) - sizeof(ItemIdData));
+ specialSize + sizeof(PageHeaderData) - sizeof(ItemIdData));
specialSize = DOUBLEALIGN(specialSize);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.46 1999/05/25 16:12:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.47 1999/07/03 00:32:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <stdio.h> /* for sprintf() */
#include <string.h>
#include "postgres.h"
+#include "access/htup.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "catalog/pg_type.h"
else
len = atttypmod - VARHDRSZ;
- if (len > BLCKSZ - 128)
- elog(ERROR, "bpcharin: length of char() must be less than %d", BLCKSZ - 128);
+ if (len > MaxTupleSize)
+ elog(ERROR, "bpcharin: length of char() must be less than %d",
+ MaxTupleSize);
result = (char *) palloc(atttypmod);
VARSIZE(result) = atttypmod;
rlen = len - VARHDRSZ;
- if (rlen > BLCKSZ - 128)
- elog(ERROR, "bpchar: length of char() must be less than %d", BLCKSZ - 128);
+ if (rlen > MaxTupleSize)
+ elog(ERROR, "bpchar: length of char() must be less than %d",
+ MaxTupleSize);
#ifdef STRINGDEBUG
printf("bpchar- convert string length %d (%d) ->%d (%d)\n",
if (atttypmod != -1 && len > atttypmod)
len = atttypmod; /* clip the string at max length */
- if (len > BLCKSZ - 128)
- elog(ERROR, "varcharin: length of char() must be less than %d", BLCKSZ - 128);
+ if (len > MaxTupleSize)
+ elog(ERROR, "varcharin: length of char() must be less than %d",
+ MaxTupleSize);
result = (char *) palloc(len);
VARSIZE(result) = len;
len = slen - VARHDRSZ;
#endif
- if (len > BLCKSZ - 128)
- elog(ERROR, "varchar: length of varchar() must be less than BLCKSZ-128");
+ if (len > MaxTupleSize)
+ elog(ERROR, "varchar: length of varchar() must be less than %d",
+ MaxTupleSize);
result = (char *) palloc(slen);
VARSIZE(result) = slen;
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: htup.h,v 1.16 1999/05/25 22:42:32 momjian Exp $
+ * $Id: htup.h,v 1.17 1999/07/03 00:32:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef HTUP_H
#define HTUP_H
-#include <utils/nabstime.h>
+#include <storage/bufpage.h>
#include <storage/itemptr.h>
#define MinHeapTupleBitmapSize 32 /* 8 * 4 */
typedef HeapTupleHeaderData *HeapTupleHeader;
+#define MinTupleSize (sizeof (PageHeaderData) + \
+ sizeof(HeapTupleHeaderData) + sizeof(int4))
+
+#define MaxTupleSize (BLCKSZ/2 - MinTupleSize)
+
#define SelfItemPointerAttributeNumber (-1)
#define ObjectIdAttributeNumber (-2)
#define MinTransactionIdAttributeNumber (-3)
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: bufpage.h,v 1.22 1999/05/25 16:14:40 momjian Exp $
+ * $Id: bufpage.h,v 1.23 1999/07/03 00:32:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
OverwritePageManagerMode
} PageManagerMode;
-/* ----------------
- * misc support macros
- * ----------------
- */
-
-/*
- * XXX this is wrong -- ignores padding/alignment, variable page size,
- * AM-specific opaque space at the end of the page (as in btrees), ...
- * however, it at least serves as an upper bound for heap pages.
- */
-#define MAXTUPLEN (BLCKSZ - sizeof (PageHeaderData))
-
/* ----------------------------------------------------------------
* page support macros
* ----------------------------------------------------------------
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+
+#include "postgres.h"
+#include "access/htup.h"
#include "catalog/catname.h"
#include "utils/numeric.h"
sprintf(errortext, "length for '%s' type must be at least 1",$1);
yyerror(errortext);
}
- else if (atol($3) > BLCKSZ - 128) {
- sprintf(errortext, "length for type '%s' cannot exceed %d",$1,BLCKSZ - 128);
+ else if (atol($3) > MaxTupleSize) {
+ sprintf(errortext, "length for type '%s' cannot exceed %d",$1,MaxTupleSize);
yyerror(errortext);
}