diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/catname.h | 3 | ||||
| -rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
| -rw-r--r-- | src/include/catalog/indexing.h | 6 | ||||
| -rw-r--r-- | src/include/catalog/pg_class.h | 3 | ||||
| -rw-r--r-- | src/include/catalog/pg_largeobject.h | 63 | ||||
| -rw-r--r-- | src/include/storage/large_object.h | 52 |
6 files changed, 105 insertions, 26 deletions
diff --git a/src/include/catalog/catname.h b/src/include/catalog/catname.h index b82977d806..54b964e215 100644 --- a/src/include/catalog/catname.h +++ b/src/include/catalog/catname.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: catname.h,v 1.16 2000/10/22 05:27:20 momjian Exp $ + * $Id: catname.h,v 1.17 2000/10/24 01:38:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,6 +29,7 @@ #define InheritsRelationName "pg_inherits" #define InheritancePrecidenceListRelationName "pg_ipl" #define LanguageRelationName "pg_language" +#define LargeObjectRelationName "pg_largeobject" #define ListenerRelationName "pg_listener" #define LogRelationName "pg_log" #define OperatorClassRelationName "pg_opclass" diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index c16c6ae83e..f6fd284f34 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: catversion.h,v 1.51 2000/10/22 17:55:49 pjw Exp $ + * $Id: catversion.h,v 1.52 2000/10/24 01:38:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200010231 +#define CATALOG_VERSION_NO 200010232 #endif diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h index 6cc98bdc32..7150a43d2d 100644 --- a/src/include/catalog/indexing.h +++ b/src/include/catalog/indexing.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: indexing.h,v 1.44 2000/10/22 05:27:20 momjian Exp $ + * $Id: indexing.h,v 1.45 2000/10/24 01:38:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -31,6 +31,7 @@ #define Num_pg_index_indices 2 #define Num_pg_inherits_indices 1 #define Num_pg_language_indices 2 +#define Num_pg_largeobject_indices 1 #define Num_pg_listener_indices 1 #define Num_pg_opclass_indices 2 #define Num_pg_operator_indices 2 @@ -62,6 +63,7 @@ #define InheritsRelidSeqnoIndex "pg_inherits_relid_seqno_index" #define LanguageNameIndex "pg_language_name_index" #define LanguageOidIndex "pg_language_oid_index" +#define LargeObjectLOidPNIndex "pg_largeobject_loid_pn_index" #define ListenerPidRelnameIndex "pg_listener_pid_relname_index" #define OpclassDeftypeIndex "pg_opclass_deftype_index" #define OpclassNameIndex "pg_opclass_name_index" @@ -92,6 +94,7 @@ extern char *Name_pg_group_indices[]; extern char *Name_pg_index_indices[]; extern char *Name_pg_inherits_indices[]; extern char *Name_pg_language_indices[]; +extern char *Name_pg_largeobject_indices[]; extern char *Name_pg_listener_indices[]; extern char *Name_pg_opclass_indices[]; extern char *Name_pg_operator_indices[]; @@ -191,6 +194,7 @@ DECLARE_UNIQUE_INDEX(pg_index_indexrelid_index on pg_index using btree(indexreli DECLARE_UNIQUE_INDEX(pg_inherits_relid_seqno_index on pg_inherits using btree(inhrelid oid_ops, inhseqno int4_ops)); DECLARE_UNIQUE_INDEX(pg_language_name_index on pg_language using btree(lanname name_ops)); DECLARE_UNIQUE_INDEX(pg_language_oid_index on pg_language using btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_largeobject_loid_pn_index on pg_largeobject using btree(loid oid_ops, pageno int4_ops)); DECLARE_UNIQUE_INDEX(pg_listener_pid_relname_index on pg_listener using btree(listenerpid int4_ops, relname name_ops)); /* This column needs to allow multiple zero entries, but is in the cache */ DECLARE_INDEX(pg_opclass_deftype_index on pg_opclass using btree(opcdeftype oid_ops)); diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index a9592e7ddb..68db583fe3 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_class.h,v 1.43 2000/10/22 17:55:49 pjw Exp $ + * $Id: pg_class.h,v 1.44 2000/10/24 01:38:41 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -174,7 +174,6 @@ DESCR(""); #define XactLockTableId 376 #define RELKIND_INDEX 'i' /* secondary index */ -#define RELKIND_LOBJECT 'l' /* large objects */ #define RELKIND_RELATION 'r' /* ordinary cataloged heap */ #define RELKIND_SPECIAL 's' /* special (non-heap) */ #define RELKIND_SEQUENCE 'S' /* SEQUENCE relation */ diff --git a/src/include/catalog/pg_largeobject.h b/src/include/catalog/pg_largeobject.h new file mode 100644 index 0000000000..7777604e27 --- /dev/null +++ b/src/include/catalog/pg_largeobject.h @@ -0,0 +1,63 @@ +/*------------------------------------------------------------------------- + * + * pg_largeobject.h + * definition of the system "largeobject" relation (pg_largeobject) + * along with the relation's initial contents. + * + * + * Portions Copyright (c) 1996-2000, PostgreSQL, Inc + * Portions Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_largeobject.h,v 1.5 2000/10/24 01:38:41 tgl Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LARGEOBJECT_H +#define PG_LARGEOBJECT_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ + +/* ---------------- + * pg_largeobject definition. cpp turns this into + * typedef struct FormData_pg_largeobject. Large object id + * is stored in loid; + * ---------------- + */ + +CATALOG(pg_largeobject) +{ + Oid loid; /* Identifier of large object */ + int4 pageno; /* Page number (starting from 0) */ + bytea data; /* Data for page (may be zero-length) */ +} FormData_pg_largeobject; + +/* ---------------- + * Form_pg_largeobject corresponds to a pointer to a tuple with + * the format of pg_largeobject relation. + * ---------------- + */ +typedef FormData_pg_largeobject *Form_pg_largeobject; + +/* ---------------- + * compiler constants for pg_largeobject + * ---------------- + */ +#define Natts_pg_largeobject 3 +#define Anum_pg_largeobject_loid 1 +#define Anum_pg_largeobject_pageno 2 +#define Anum_pg_largeobject_data 3 + +extern Oid LargeObjectCreate(Oid loid); +extern void LargeObjectDrop(Oid loid); +extern bool LargeObjectExists(Oid loid); + +#endif /* PG_LARGEOBJECT_H */ diff --git a/src/include/storage/large_object.h b/src/include/storage/large_object.h index c480f5b787..6bb0c4fcf2 100644 --- a/src/include/storage/large_object.h +++ b/src/include/storage/large_object.h @@ -8,39 +8,54 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: large_object.h,v 1.17 2000/10/22 05:27:23 momjian Exp $ + * $Id: large_object.h,v 1.18 2000/10/24 01:38:43 tgl Exp $ * *------------------------------------------------------------------------- */ #ifndef LARGE_OBJECT_H #define LARGE_OBJECT_H -#include <sys/types.h> +#include "utils/rel.h" -#include "access/relscan.h" -/* - * This structure will eventually have lots more stuff associated with it. +/*---------- + * Data about a currently-open large object. + * + * id is the logical OID of the large object + * offset is the current seek offset within the LO + * heap_r holds an open-relation reference to pg_largeobject + * index_r holds an open-relation reference to pg_largeobject_loid_pn_index + * + * NOTE: before 7.1, heap_r and index_r held references to the separate + * table and index of a specific large object. Now they all live in one rel. + *---------- */ -typedef struct LargeObjectDesc -{ - Relation heap_r; /* heap relation */ - Relation index_r; /* index relation on seqno attribute */ - IndexScanDesc iscan; /* index scan we're using */ - TupleDesc hdesc; /* heap relation tuple desc */ - TupleDesc idesc; /* index relation tuple desc */ - uint32 lowbyte; /* low byte on the current page */ - uint32 highbyte; /* high byte on the current page */ +typedef struct LargeObjectDesc { + Oid id; uint32 offset; /* current seek pointer */ - ItemPointerData htid; /* tid of current heap tuple */ + int flags; /* locking info, etc */ +/* flag bits: */ #define IFS_RDLOCK (1 << 0) #define IFS_WRLOCK (1 << 1) -#define IFS_ATEOF (1 << 2) - u_long flags; /* locking info, etc */ + Relation heap_r; + Relation index_r; } LargeObjectDesc; + +/* + * Each "page" (tuple) of a large object can hold this much data + * + * Calculation is max tuple size less tuple header, loid field (Oid), + * pageno field (int32), and varlena header of data (int32). Note we + * assume none of the fields will be NULL, hence no need for null bitmap. + */ +#define LOBLKSIZE (MaxTupleSize \ + - MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) \ + - sizeof(Oid) - sizeof(int32) * 2) + + /* * Function definitions... */ @@ -55,7 +70,4 @@ extern int inv_tell(LargeObjectDesc *obj_desc); extern int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes); extern int inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes); -/* added for buffer leak prevention [ PA ] */ -extern void inv_cleanindex(LargeObjectDesc *obj_desc); - #endif /* LARGE_OBJECT_H */ |
