Re: [HACKERS] temp table oddness?

From: "flo" <gabbin(at)actcom(dot)co(dot)il>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] temp table oddness?
Date: 1999-09-07 03:52:09
Message-ID: 7r225t$cdf$1@lnews.actcom.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm interested in learning how to hack any suggestions how to go about it?
Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> wrote in message
news:199909041457(dot)KAA18485(at)candle(dot)pha(dot)pa(dot)us(dot)(dot)(dot)
> > 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Vadim Mikheev 1999-09-07 04:13:39 Re: [HACKERS] DROP TABLE inside transaction block
Previous Message Philip Warner 1999-09-07 03:19:24 Re: [HACKERS] DROP TABLE inside transaction block