Обсуждение: Permission denied for create table
Hello, I’m doing a workshop for my students and I’m teaching them how to create tables in Postgres.
So I created a database for every student, but I’m facing the following problem:
sql073751=> CREATE TABLE emp1 (id int);
CREATE TABLE
sql073751=> SELECT * into emp2 from emp;
ERROR: emp: permission denied
sql073751=> CREATE TABLE emp3 as SELECT * from emp;
ERROR: emp: permission denied
Creating a normal table works fine, but creating a table with subqueries is giving me “permission denied”
Anyone got a clue?
P.S. I’m working on PostgreSQL 7.3.2
Thx
Pascal
On Mon, Nov 24, 2008 at 7:50 AM, Pascal Tufenkji <ptufenkji@usj.edu.lb> wrote: > sql073751=> SELECT * into emp2 from emp; > > ERROR: emp: permission denied > Creating a normal table works fine, but creating a table with subqueries is > giving me "permission denied" > > Anyone got a clue? You don't have SELECT permissions on emp table. You are trying to create a emp2 table using data from emp. That won't work if you can't access emp in the first place. > P.S. I'm working on PostgreSQL 7.3.2 Whoa. Are you paleontologist per any chance? ;-)
Pascal Tufenkji wrote: > > P.S. I'm working on PostgreSQL 7.3.2 In case you missed Marcin's comment - don't use this version. Upgrade. Version 7.3 is no longer supported by the core developers. Even if you were determined to run 7.3 you should have upgraded to 7.3.21 at some point. Read through the release notes and check what bugs have been fixed since7.3.2: http://www.postgresql.org/docs/8.3/static/release.html So - don't use 7.3.2 AT ALL - upgrade to a more recent release. The latest version is 8.3.5, and that would be a good choice. If that's not possible, then 7.3.21 at least. -- Richard Huxton Archonet Ltd
"Pascal Tufenkji" <ptufenkji@usj.edu.lb> writes:
> Creating a normal table works fine, but creating a table with subqueries is
> giving me "permission denied"
You need to explicitly grant select permission on the child tables not
just the parent.
> P.S. I'm working on PostgreSQL 7.3.2
As already noted, you really ought to update that ... among other
things, the documentation in recent versions explicitly covers the
point above ;-)
regards, tom lane