*** pgsql/contrib/pgstattuple/pgstattuple.c 2008/06/19 00:46:03 1.36 --- pgsql/contrib/pgstattuple/pgstattuple.c 2009/03/31 22:54:31 1.37 *************** *** 1,5 **** /* ! * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.35 2008/05/16 17:31:17 tgl Exp $ * * Copyright (c) 2001,2002 Tatsuo Ishii * --- 1,5 ---- /* ! * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.36 2008/06/19 00:46:03 alvherre Exp $ * * Copyright (c) 2001,2002 Tatsuo Ishii * *************** pgstat_relation(Relation rel, FunctionCa *** 199,204 **** --- 199,214 ---- { 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: