Re: temp table problem

From: "Robert Haas" <robertmhaas(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: abbas(dot)butt(at)enterprisedb(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: temp table problem
Date: 2008-07-19 02:13:37
Message-ID: 603c8f070807181913s5b28b38kfcba21bb32e24776@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I can't help suspecting that the two statements in question were run
in different sessions (or at least different transactions?).

...Robert

On Fri, Jul 18, 2008 at 9:11 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Abbas" <abbas(dot)butt(at)enterprisedb(dot)com> writes:
>> I have come across a problem. When you try to access a temp table
>> created via SPI_EXEC, you get a table not found error.
>
>> SPI_EXEC("CREATE TEMP TABLE my_temp_table(first_name text, last_name
>> text)", UTILITY);
>> SPI_EXEC("REVOKE ALL ON TABLE my_temp_table FROM PUBLIC", UTILITY);
>
>> The second statement generates a table not found error, although the
>> first statement was successful.
>
> Works for me ...
>
> ret = SPI_execute("CREATE TEMP TABLE my_temp_table(first_name text, last_name text)", false, 0);
>
> if (ret != SPI_OK_UTILITY)
> elog(ERROR, "SPI_execute(CREATE) returned %d", ret);
>
> ret = SPI_execute("REVOKE ALL ON TABLE my_temp_table FROM PUBLIC", false, 0);
>
> if (ret != SPI_OK_UTILITY)
> elog(ERROR, "SPI_execute(REVOKE) returned %d", ret);
>
> What PG version are you testing? Maybe you need to show a complete
> test case, instead of leaving us to guess at details?
>
> regards, tom lane
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-07-19 03:28:57 Getting to universal binaries for Darwin
Previous Message Gurjeet Singh 2008-07-19 01:39:46 Re: Load spikes on 8.1.11