Thread: temporary table oddity

temporary table oddity

From
jwsacksteder@ramprecision.com
Date:
If I try to make a temporary table like this-

create temporary table current_inventory AS
select * from inventory where qty > 0

- I get a table called 'pg_temp_4473_0' instead of my specified name.

What gives? Why did this stop working for me?

(Please respond directly to me. I'm not currently subscribed)

Re: temporary table oddity

From
Doug McNaught
Date:
jwsacksteder@ramprecision.com writes:

> If I try to make a temporary table like this-
>
> create temporary table current_inventory AS
> select * from inventory where qty > 0
>
> - I get a table called 'pg_temp_4473_0' instead of my specified name.

Postgres 7.3, right?

That's a schema, not a table.  The temporary table is in that schema.

You shouldn't need to do anything special, though.  What are you
doing, exactly, and what error do you get?

-Doug

Re: temporary table oddity

From
Bruce Momjian
Date:
In < 7.3, that is the internal table name. References to the table will
still work.

In 7.3 all temp tables are in their own schema, so they have usual
names.

---------------------------------------------------------------------------

jwsacksteder@ramprecision.com wrote:
> If I try to make a temporary table like this-
>
> create temporary table current_inventory AS
> select * from inventory where qty > 0
>
> - I get a table called 'pg_temp_4473_0' instead of my specified name.
>
> What gives? Why did this stop working for me?
>
> (Please respond directly to me. I'm not currently subscribed)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073


Re: temporary table oddity

From
jwsacksteder@ramprecision.com
Date:
I should clarify- I am using PG 7.2 and composing my queries with pgAdminII
on win32.

If I try to select * from that temp table, I get an error claiming relation
does not exist. I had used temp tables previously, but I think that may have
been on 7.1.

Is it possible temp tables have subtly changed, breaking my GUI?

If I make a query like this, it complains 'current_inventory' does not
exist.

"create temporary table current_inventory AS select *
from inventory where qty > 0;

select * from current_inventory"



>In < 7.3, that is the internal table name. References to the table will
>still work.
>
>In 7.3 all temp tables are in their own schema, so they have usual
>names.
>
>---------------------------------------------------------------------------
>
>jwsacksteder@ramprecision.com wrote:
>> If I try to make a temporary table like this-
>>
>> create temporary table current_inventory AS
>> select * from inventory where qty > 0
>>
>> - I get a table called 'pg_temp_4473_0' instead of my specified name.