mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +03:00
BACKED OUT.
> Regression tests opr_sanity and sanity_check are now failing. Um, Bruce, I've said several times that I didn't think Perchine's large object changes should be applied until someone had actually reviewed them.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Makefile for catalog
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.29 2000/10/21 15:55:21 momjian Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.30 2000/10/22 05:27:10 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -11,8 +11,7 @@ top_builddir = ../../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
OBJS = catalog.o heap.o index.o indexing.o aclchk.o \
|
||||
pg_aggregate.o pg_largeobject.o pg_operator.o pg_proc.o \
|
||||
pg_type.o
|
||||
pg_aggregate.o pg_operator.o pg_proc.o pg_type.o
|
||||
|
||||
BKIFILES = global.bki template1.bki global.description template1.description
|
||||
|
||||
@@ -30,7 +29,7 @@ TEMPLATE1_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/,\
|
||||
pg_proc.h pg_type.h pg_attribute.h pg_class.h \
|
||||
pg_inherits.h pg_index.h pg_statistic.h \
|
||||
pg_operator.h pg_opclass.h pg_am.h pg_amop.h pg_amproc.h \
|
||||
pg_language.h pg_largeobject.h \
|
||||
pg_language.h \
|
||||
pg_aggregate.h pg_ipl.h pg_inheritproc.h \
|
||||
pg_rewrite.h pg_listener.h pg_description.h indexing.h \
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.70 2000/10/21 15:55:21 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.71 2000/10/22 05:27:10 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -51,8 +51,6 @@ char *Name_pg_inherits_indices[Num_pg_inherits_indices] =
|
||||
{InheritsRelidSeqnoIndex};
|
||||
char *Name_pg_language_indices[Num_pg_language_indices] =
|
||||
{LanguageOidIndex, LanguageNameIndex};
|
||||
char *Name_pg_largeobject_indices[Num_pg_largeobject_indices] =
|
||||
{LargeobjectLOIdIndex, LargeobjectLOIdPNIndex};
|
||||
char *Name_pg_listener_indices[Num_pg_listener_indices] =
|
||||
{ListenerPidRelnameIndex};
|
||||
char *Name_pg_opclass_indices[Num_pg_opclass_indices] =
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* pg_largeobject.c
|
||||
* routines to support manipulation of the pg_largeobject relation
|
||||
*
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_largeobject.c,v 1.3 2000/10/21 15:55:21 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/heapam.h"
|
||||
#include "catalog/catname.h"
|
||||
#include "catalog/indexing.h"
|
||||
#include "catalog/pg_largeobject.h"
|
||||
#include "miscadmin.h"
|
||||
#include "utils/fmgroids.h"
|
||||
|
||||
bytea *_byteain(const char *data, int32 size);
|
||||
|
||||
bytea *_byteain(const char *data, int32 size) {
|
||||
bytea *result;
|
||||
|
||||
result = (bytea *)palloc(size + VARHDRSZ);
|
||||
result->vl_len = size + VARHDRSZ;
|
||||
if (size > 0)
|
||||
memcpy(result->vl_dat, data, size);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Oid LargeobjectCreate(Oid loid) {
|
||||
Oid retval;
|
||||
Relation pg_largeobject;
|
||||
HeapTuple ntup = (HeapTuple) palloc(sizeof(HeapTupleData));
|
||||
Relation idescs[Num_pg_largeobject_indices];
|
||||
Datum values[Natts_pg_largeobject];
|
||||
char nulls[Natts_pg_largeobject];
|
||||
int i;
|
||||
|
||||
for (i=0; i<Natts_pg_largeobject; i++) {
|
||||
nulls[i] = ' ';
|
||||
values[i] = (Datum)NULL;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
values[i++] = ObjectIdGetDatum(loid);
|
||||
values[i++] = Int32GetDatum(0);
|
||||
values[i++] = (Datum) _byteain(NULL, 0);
|
||||
|
||||
pg_largeobject = heap_openr(LargeobjectRelationName, RowExclusiveLock);
|
||||
ntup = heap_formtuple(pg_largeobject->rd_att, values, nulls);
|
||||
retval = heap_insert(pg_largeobject, ntup);
|
||||
|
||||
if (!IsIgnoringSystemIndexes()) {
|
||||
CatalogOpenIndices(Num_pg_largeobject_indices, Name_pg_largeobject_indices, idescs);
|
||||
CatalogIndexInsert(idescs, Num_pg_largeobject_indices, pg_largeobject, ntup);
|
||||
CatalogCloseIndices(Num_pg_largeobject_indices, idescs);
|
||||
}
|
||||
|
||||
heap_close(pg_largeobject, RowExclusiveLock);
|
||||
heap_freetuple(ntup);
|
||||
|
||||
CommandCounterIncrement();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void LargeobjectDrop(Oid loid) {
|
||||
Relation pg_largeobject;
|
||||
Relation pg_lo_id;
|
||||
ScanKeyData skey;
|
||||
IndexScanDesc sd = (IndexScanDesc) NULL;
|
||||
RetrieveIndexResult indexRes;
|
||||
int found = 0;
|
||||
|
||||
ScanKeyEntryInitialize(&skey,
|
||||
(bits16) 0x0,
|
||||
(AttrNumber) 1,
|
||||
(RegProcedure) F_OIDEQ,
|
||||
ObjectIdGetDatum(loid));
|
||||
|
||||
pg_largeobject = heap_openr(LargeobjectRelationName, RowShareLock);
|
||||
pg_lo_id = index_openr(LargeobjectLOIdIndex);
|
||||
|
||||
sd = index_beginscan(pg_lo_id, false, 1, &skey);
|
||||
|
||||
while((indexRes = index_getnext(sd, ForwardScanDirection))) {
|
||||
found++;
|
||||
heap_delete(pg_largeobject, &indexRes->heap_iptr, NULL);
|
||||
pfree(indexRes);
|
||||
}
|
||||
|
||||
index_endscan(sd);
|
||||
|
||||
index_close(pg_lo_id);
|
||||
heap_close(pg_largeobject, RowShareLock);
|
||||
if (found == 0)
|
||||
elog(ERROR, "LargeobjectDrop: large object %d not found", loid);
|
||||
}
|
||||
|
||||
int LargeobjectFind(Oid loid) {
|
||||
int retval = 0;
|
||||
Relation pg_lo_id;
|
||||
ScanKeyData skey;
|
||||
IndexScanDesc sd = (IndexScanDesc) NULL;
|
||||
RetrieveIndexResult indexRes;
|
||||
|
||||
ScanKeyEntryInitialize(&skey,
|
||||
(bits16) 0x0,
|
||||
(AttrNumber) 1,
|
||||
(RegProcedure) F_OIDEQ,
|
||||
ObjectIdGetDatum(loid));
|
||||
|
||||
pg_lo_id = index_openr(LargeobjectLOIdIndex);
|
||||
|
||||
sd = index_beginscan(pg_lo_id, false, 1, &skey);
|
||||
|
||||
if ((indexRes = index_getnext(sd, ForwardScanDirection))) {
|
||||
retval = 1;
|
||||
pfree(indexRes);
|
||||
}
|
||||
|
||||
index_endscan(sd);
|
||||
|
||||
index_close(pg_lo_id);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.53 2000/10/21 15:55:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.54 2000/10/22 05:27:12 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This should be moved to a more appropriate place. It is here
|
||||
@@ -267,7 +267,7 @@ lo_creat(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_OID(InvalidOid);
|
||||
}
|
||||
|
||||
lobjId = lobjDesc->id;
|
||||
lobjId = RelationGetRelid(lobjDesc->heap_r);
|
||||
|
||||
inv_close(lobjDesc);
|
||||
|
||||
@@ -512,10 +512,8 @@ lo_commit(bool isCommit)
|
||||
{
|
||||
if (cookies[i] != NULL)
|
||||
{
|
||||
/*
|
||||
if (isCommit)
|
||||
inv_cleanindex(cookies[i]);
|
||||
*/
|
||||
cookies[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user