/*
- * $PostgreSQL: pgsql/contrib/pageinspect/btreefuncs.c,v 1.8 2008/05/17 01:28:19 adunstan Exp $
+ * $PostgreSQL: pgsql/contrib/pageinspect/btreefuncs.c,v 1.9 2009/03/31 22:54:31 tgl Exp $
*
*
* btreefuncs.c
elog(ERROR, "relation \"%s\" is not a btree index",
RelationGetRelationName(rel));
+ /*
+ * Reject attempts to read non-local temporary relations; we would
+ * be likely to get wrong data since we have no visibility into the
+ * owning session's local buffers.
+ */
+ if (RELATION_IS_OTHER_TEMP(rel))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot access temporary tables of other sessions")));
+
if (blkno == 0)
elog(ERROR, "block 0 is a meta page");
elog(ERROR, "relation \"%s\" is not a btree index",
RelationGetRelationName(rel));
+ /*
+ * Reject attempts to read non-local temporary relations; we would
+ * be likely to get wrong data since we have no visibility into the
+ * owning session's local buffers.
+ */
+ if (RELATION_IS_OTHER_TEMP(rel))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot access temporary tables of other sessions")));
+
if (blkno == 0)
elog(ERROR, "block 0 is a meta page");
elog(ERROR, "relation \"%s\" is not a btree index",
RelationGetRelationName(rel));
+ /*
+ * Reject attempts to read non-local temporary relations; we would
+ * be likely to get wrong data since we have no visibility into the
+ * owning session's local buffers.
+ */
+ if (RELATION_IS_OTHER_TEMP(rel))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot access temporary tables of other sessions")));
+
buffer = ReadBuffer(rel, 0);
page = BufferGetPage(buffer);
metad = BTPageGetMeta(page);
* Copyright (c) 2007-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/pageinspect/rawpage.c,v 1.10 2009/01/01 17:23:32 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/pageinspect/rawpage.c,v 1.11 2009/03/31 22:54:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
errmsg("cannot get raw page from composite type \"%s\"",
RelationGetRelationName(rel))));
+ /*
+ * Reject attempts to read non-local temporary relations; we would
+ * be likely to get wrong data since we have no visibility into the
+ * owning session's local buffers.
+ */
+ if (RELATION_IS_OTHER_TEMP(rel))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot access temporary tables of other sessions")));
+
if (blkno >= RelationGetNumberOfBlocks(rel))
elog(ERROR, "block number %u is out of range for relation \"%s\"",
blkno, RelationGetRelationName(rel));
/*
- * $PostgreSQL: pgsql/contrib/pgstattuple/pgstatindex.c,v 1.11 2008/05/17 01:28:22 adunstan Exp $
+ * $PostgreSQL: pgsql/contrib/pgstattuple/pgstatindex.c,v 1.12 2009/03/31 22:54:31 tgl Exp $
*
*
* pgstatindex
elog(ERROR, "relation \"%s\" is not a btree index",
RelationGetRelationName(rel));
+ /*
+ * Reject attempts to read non-local temporary relations; we would
+ * be likely to get wrong data since we have no visibility into the
+ * owning session's local buffers.
+ */
+ if (RELATION_IS_OTHER_TEMP(rel))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot access temporary tables of other sessions")));
+
/*
* Read metapage
*/
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
rel = relation_openrv(relrv, AccessShareLock);
+ /* note: this will work OK on non-local temp tables */
+
relpages = RelationGetNumberOfBlocks(rel);
relation_close(rel, AccessShareLock);
/*
- * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.36 2008/06/19 00:46:03 alvherre Exp $
+ * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.37 2009/03/31 22:54:31 tgl Exp $
*
* Copyright (c) 2001,2002 Tatsuo Ishii
*
{
const char *err;
+ /*
+ * Reject attempts to read non-local temporary relations; we would
+ * be likely to get wrong data since we have no visibility into the
+ * owning session's local buffers.
+ */
+ if (RELATION_IS_OTHER_TEMP(rel))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot access temporary tables of other sessions")));
+
switch (rel->rd_rel->relkind)
{
case RELKIND_RELATION: