Re: temp table problem - Mailing list pgsql-hackers

From Tom Lane
Subject Re: temp table problem
Date
Msg-id 12153.1216429909@sss.pgh.pa.us
Whole thread Raw
In response to temp table problem  ("Abbas" <abbas.butt@enterprisedb.com>)
Responses Re: temp table problem  ("Robert Haas" <robertmhaas@gmail.com>)
Re: temp table problem  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
List pgsql-hackers
"Abbas" <abbas.butt@enterprisedb.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


pgsql-hackers by date:

Previous
From: Kenneth Marshall
Date:
Subject: Re: [PATCH]-hash index improving
Next
From: "Gurjeet Singh"
Date:
Subject: Re: Load spikes on 8.1.11