Re: [HACKERS] temp table oddness?

Поиск
Список
Период
Сортировка
От flo
Тема Re: [HACKERS] temp table oddness?
Дата
Msg-id 7r225t$cdf$1@lnews.actcom.co.il
обсуждение исходный текст
Ответ на Re: [HACKERS] temp table oddness?  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
I'm interested in learning how to hack any suggestions how to go about it?
Bruce Momjian <maillist@candle.pha.pa.us> wrote in message
news:199909041457.KAA18485@candle.pha.pa.us...
> > 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);
> CREATE
> test=> insert into u1 values(1);
> INSERT 18697 1
> test=> insert into u1 values(1);
> INSERT 18698 1
> test=> create temp table u1(i int);
> CREATE
> test=> 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  0x812a6c8 in 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) at main.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);
> CREATE
> test=> insert into u1 values(1);
> INSERT 18889 1
> test=> insert into u1 values(1);
> INSERT 18890 1
> test=> begin;
> BEGIN
> test=> create temp table u1(i int);
> CREATE
> test=> create unique index i_u1 on u1(i);
> CREATE
> test=> end;
> NOTICE:  trying to delete a reldesc that does not exist.
> NOTICE:  trying to delete a 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, Pennsylvania 19026




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Philip Warner
Дата:
Сообщение: Re: [HACKERS] DROP TABLE inside transaction block
Следующее
От: Vadim Mikheev
Дата:
Сообщение: Re: [HACKERS] DROP TABLE inside transaction block