*** pgsql/contrib/pgstattuple/pgstattuple.c 2005/10/15 02:49:06 1.20 --- pgsql/contrib/pgstattuple/pgstattuple.c 2009/03/31 22:56:05 1.20.2.1 *************** *** 1,5 **** /* ! * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.19 2005/05/30 23:09:06 tgl Exp $ * * Copyright (c) 2001,2002 Tatsuo Ishii * --- 1,5 ---- /* ! * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.20 2005/10/15 02:49:06 momjian Exp $ * * Copyright (c) 2001,2002 Tatsuo Ishii * *************** pgstattuple_real(Relation rel, FunctionC *** 115,120 **** --- 115,130 ---- int i; Datum result; + /* + * 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 (isOtherTempNamespace(RelationGetNamespace(rel))) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("cannot access temporary tables of other sessions"))); + /* Build a tuple descriptor for our result type */ if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE) elog(ERROR, "return type must be a row type");