RE: RE: [PATCHES] relation filename patch

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Ross J(dot) Reedstrom" <reedstrm(at)wallace(dot)ece(dot)rice(dot)edu>, "pgsql-hackers" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: RE: RE: [PATCHES] relation filename patch
Date: 2000-05-01 04:31:51
Message-ID: 000101bfb326$2bc197e0$2801007e@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
>
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > > -----Original Message-----
> > > From: Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
> > >
> > > > If I recognize correctly,RelationGetRelationName() macro returns the
> > > > relation name local to the backend and RelationGetPhysicalRelation-
> > > > Name() macro returns pg_class entry name currently. Those names
> > > > are same unless the relation is a temporary relation. They may be
> > > > able to have separate entries in pg_class. I don't know why they
> > > > don't currently.
> > >
> > > Different backends can have the same temp file names at the same time,
> > > so you would have to have a pg_class tuple that is visible only to the
> > > current transactions, and allow multiple duplicate ones.
> Easier not to
> > > have it in pg_class and just hack the syscache code.
> > >
> >
> > You are right. It seems sufficient to have an entry in relation
> descriptor
> > for the local relation name.
>
> Actually it is the system catalog cache. The pg_class lookups to a
> translation from temp to physical name on pg_class lookups. Only a few
> lines in backend/utils/cache/syscache.c:
>
> /* temp table name remapping */
> if (cacheId == RELNAME)
> {
> char *nontemp_relname;
>
> if ((nontemp_relname =
> get_temp_rel_by_username(DatumGetPointer(key1))) != NULL)
> key1 = PointerGetDatum(nontemp_relname);
> }
>
> That is it, and temprel.c.
>

It's diffrent from what I meant.
My question is why the macro RelationGetRelationName()
needs the following implementation.
Is it bad to add another entry such as rd_username to relation
descriptor ?

#define RelationGetRelationName(relation) \
(\
(strncmp(RelationGetPhysicalRelationName(relation), \
"pg_temp.", strlen("pg_temp.")) != 0) \
? \
RelationGetPhysicalRelationName(relation) \
: \
get_temp_rel_by_physicalname( \
RelationGetPhysicalRelationName(relation)) \
)

Regards.

Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-05-01 04:36:44 Re: RE: [PATCHES] relation filename patch
Previous Message Thomas Lockhart 2000-05-01 04:31:50 Back in town