Re: [HACKERS] temp table oddness?

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] temp table oddness?
Дата
Msg-id 199909041457.KAA18485@candle.pha.pa.us
обсуждение исходный текст
Ответ на temp table oddness?  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Ответы Re: [HACKERS] temp table oddness?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] temp table oddness?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> I found weird behavior with temp tables.
> 
> test=> create table u1(i int);
> CREATE
> test=> insert into u1 values(1);
> INSERT 3408201 1
> test=> insert into u1 values(1);
> INSERT 3408202 1
> test=> create temp table u1(i int primary key);
> NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'u1_pkey' for table 'u1'
> NOTICE:  trying to delete a reldesc that does not exist.
> NOTICE:  trying to delete a reldesc that does not exist.
> CREATE
> 
> Are these notices normal?

Not normal.  This works:test=> create table u1(i int);CREATEtest=> insert into u1 values(1);INSERT 18697 1test=> insert
intou1 values(1);INSERT 18698 1test=> create temp table u1(i int);CREATEtest=> create unique index i_u1 on
u1(i);CREATE

Backtrace shows:#0  elog (lev=0,     fmt=0x81700e7 "trying to delete a reldesc that does not exist.")    at elog.c:75#1
0x812a1f6 in RelationFlushRelation (relationPtr=0x8043510,     onlyFlushReferenceCountZero=0) at relcache.c:1262#2
0x812a6c8in RelationPurgeLocalRelation (xactCommitted=1 '\001')    at relcache.c:1533#3  0x8086c3f in CommitTransaction
()at xact.c:954#4  0x8086e2c in CommitTransactionCommand () at xact.c:1172#5  0x80ff559 in PostgresMain (argc=4,
argv=0x80475a8,real_argc=4,     real_argv=0x80475a8) at postgres.c:1654#6  0x80b619c in main (argc=4, argv=0x80475a8)
atmain.c:102#7  0x80607fc in __start ()
 

What I don't understand why the PRIMARY is different than creating the
index manually...  OK, got the reason:test=> create table u1(i int);CREATEtest=> insert into u1 values(1);INSERT 18889
1test=>insert into u1 values(1);INSERT 18890 1test=> begin;BEGINtest=> create temp table u1(i int);CREATEtest=> create
uniqueindex i_u1 on u1(i);CREATEtest=> end;NOTICE:  trying to delete a reldesc that does not exist.NOTICE:  trying to
deletea reldesc that does not exist.END
 

The cause is that the index creation is happening in the same
transaction as the create of the temp table.  Any comments on a cause?
Tom Lane's cache changes may address this.


--  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 по дате отправления:

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: temp table oddness?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] array manipulations