Re: [HACKERS] Cannot insert into temp tables

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter(at)pathwaynet(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Cannot insert into temp tables
Date: 1999-07-30 18:08:09
Message-ID: 199907301808.OAA02082@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I mentioned this the other day on another list. I want to reiterate it
> here because I can't seem to get anywhere.
>
> I create a temporary table
> => create temp table foo (bar text);
> CREATE
> => insert into foo values ('hi');
> ERROR: pg_temp.29112.0: Permission denied.
>
> This apparently happens if and only if the user that executes this has
> pg_shadow.usecatupd = 'f'.
>
> I have tried this with the 6.5.1 source rpm bundle, fresh after initdb and
> also with a 6.5.0 tar ball installation -- same result. (both on RH Linux
> 5.2-ish)
>
> A potential reason that this has gone unnoticed so far is that when you
> create a user thus:
> => create user joe;
> the usecatupd defaults to true (why?).
>
> Also this does not have anything to do with superuser status, the ability
> to create and use regular tables, the ability to create databases, the
> datatypes in the temp table, any hba stuff, or anything else I could think
> of.

OK, you have good points. usecatupd should not be set by default.
Making changes to the system tables can mess things up for everyone.
Initdb will give the postgres superuser permissions, but now createuser
and the SQL command CREATE USER will not give this permission. Also, I
have fixed the code so temp tables, which are acutally named pg_temp,
can be updated by normal users without usecatupd permissions.

Attached is a patch. I will apply it to the current tree.

--
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

Attachment Content-Type Size
unknown_filename text/plain 4.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Don Baccus 1999-07-30 18:13:39 RE: [HACKERS] web-based front end development
Previous Message Tom Lane 1999-07-30 17:59:38 Re: [HACKERS] Patches for Postgresql on Linux/Alpha!