Skip site navigation (1) Skip section navigation (2)

Re: Removal of temp tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Removal of temp tables
Date: 2001-06-14 17:13:04
Message-ID: 18432.992538784@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Here is an updated patch that uses underscores in temp table names so
> the DROP doesn't have to quote the table name:

That seems like a reasonable idea, but don't do it to temp file
names, ie, drop this part of the diff:

> *** src/backend/storage/file/fd.c	2001/06/11 04:12:29	1.81
> --- src/backend/storage/file/fd.c	2001/06/14 16:34:02
> ***************
> *** 756,762 ****
>   	 * transaction and database instance.
>   	 */
>   	snprintf(tempfilepath, sizeof(tempfilepath),
> ! 			 "%s/%s%d.%ld", PG_TEMP_FILES_DIR, PG_TEMP_FILE_PREFIX,
>   			 MyProcPid, tempFileCounter++);
  
>   	/*
> --- 756,762 ----
>   	 * transaction and database instance.
>   	 */
>   	snprintf(tempfilepath, sizeof(tempfilepath),
> ! 			 "%s/%s%d_%ld", PG_TEMP_FILES_DIR, PG_TEMP_FILE_PREFIX,
>   			 MyProcPid, tempFileCounter++);
  
>   	/*

There's no reason to spell temp file names as if they were rel names,
and probably it's best not to make them look the same.

Also, an item I've ranted about before:

> + #define is_temp_relname(relname) \
> + 		(!strncmp(relname, PG_TEMP_REL_PREFIX, strlen(PG_TEMP_REL_PREFIX)))

It's bad style to treat the result of strcmp or strncmp as though it
were a boolean, cf
http://fts.postgresql.org/db/mw/msg.html?mid=68294
Write (strncmp(...) == 0) instead.


Otherwise the patch seems reasonable, although I wonder what your
motivation was for choosing these particular IsSystemRelationName calls
to tweak.  It looks like you did more than the minimum needed to allow
a DROP TABLE; why these extra ones and not others?  (Not that I'm
encouraging you to go around and hit every IsSystemRelationName call.
If you did, that'll just be more changes that I suspect we'll have to
remove again in the long run.  I'm just curious why you touched, for
example, VACUUM.)

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2001-06-14 17:25:37
Subject: Re: Removal of temp tables
Previous:From: Bruce MomjianDate: 2001-06-14 16:48:47
Subject: Re: remote database queries

pgsql-patches by date

Next:From: Bruce MomjianDate: 2001-06-14 17:25:37
Subject: Re: Removal of temp tables
Previous:From: Bruce MomjianDate: 2001-06-14 16:36:48
Subject: Re: Removal of temp tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group