temporary table oddity

Started by Jeff Sackstederabout 23 years ago4 messagesgeneral
Jump to latest
#1Jeff Sacksteder
jwsacksteder@ramprecision.com

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)

#2Doug McNaught
doug@mcnaught.org
In reply to: Jeff Sacksteder (#1)
Re: temporary table oddity

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

#3Bruce Momjian
bruce@momjian.us
In reply to: Jeff Sacksteder (#1)
Re: temporary table oddity

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
#4Jeff Sacksteder
jwsacksteder@ramprecision.com
In reply to: Bruce Momjian (#3)
Re: temporary table oddity

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"

Show quoted text

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.