Re: AW: [HACKERS] Another TEMP table trick - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: AW: [HACKERS] Another TEMP table trick
Date
Msg-id 199901300513.AAA07673@candle.pha.pa.us
Whole thread Raw
In response to AW: [HACKERS] Another TEMP table trick  (Zeugswetter Andreas IZ5 <Andreas.Zeugswetter@telecom.at>)
List pgsql-hackers
>     >> test=> create table test (x int);
>     >> CREATE
>     >> test=> insert into test values (1);
>     >> INSERT 
>     >> test=> create temp table test (x int);  <--
>     >> CREATE                                  <--
>     >> test=> insert into test values (2);
>     >> INSERT 19787 1
>     >> test=> select * from test;
>     >> x
>     >> -
>     >> 2
>     >> (1 row)
>     >> 
>     >> test=> drop table test;
>     >> DROP
>     >> test=> select * from test;
>     >> x
>     >> -
>     >> 1
>     >> (1 row)
>     >> 
>     >> test=> drop table test;
>     >> DROP
> 
> Do you really think that this should be allowed ? I think table names
> including 
> temp tables should (at least in combination with the owner) be unique. I
> think your 
> example above demonstrates how confusing the application code can get.

I think it should be allowed.  Suppose someone has created a non-temp
table with a certain name, and you want a temp table with that name.  No
reason you shouldn't be allowed to do that.  Five people can all have
temp tables with the same name, so it doesn't matter if there is a
non-temp table with that name too.

> 
> I think it is good, that temp tables are not really inserted into system
> tables,
> since this would be substantial overhead.

Not really much overhead.

> There could be a problem with GUI tools that rely on these rows
> to format their output (like pgaccess or ODBC --> M$ Access) though.

Oh, never thought of that.  A select of pg_class will return no rows for
that table because it is a temp table.


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] new heap manager mmalloc
Next
From: "Hiroshi Inoue"
Date:
Subject: RE: [HACKERS] READ COMMITTED isolevel is implemented ...