Thread: Permission denied for create table
<div class="Section1"><p class="MsoNormal"><font face="Verdana" size="2"><span style="font-size:10.0pt; font-family:Verdana">Hello, I’m doing a workshop for my students and I’m teaching them how to create tables in Postgres.</span></font><pclass="MsoNormal"><font face="Verdana" size="2"><span style="font-size:10.0pt; font-family:Verdana">So I created a database for every student, but I’m facing the following problem:</span></font><p class="MsoNormal"><fontface="Verdana" size="2"><span style="font-size:10.0pt; font-family:Verdana"> </span></font><p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New"">sql073751=> CREATE TABLE emp1 (id int);</span></font><p class="MsoNormal"><font face="CourierNew" size="2"><span style="font-size:10.0pt; font-family:"Courier New"">CREATE TABLE</span></font><p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New""> </span></font><p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New"">sql073751=> SELECT * into emp2 from emp;</span></font><p class="MsoNormal"><font face="CourierNew" size="2"><span style="font-size:10.0pt; font-family:"Courier New"">ERROR: emp: permission denied</span></font><p class="MsoNormal"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt; font-family:"Courier New""> </span></font><p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New"">sql073751=> CREATE TABLE emp3 as SELECT * from emp;</span></font><p class="MsoNormal"><fontface="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New"">ERROR: emp: permission denied</span></font><p class="MsoNormal"><font face="Verdana" size="2"><spanstyle="font-size:10.0pt; font-family:Verdana"> </span></font><p class="MsoNormal"><font face="Verdana" size="2"><span style="font-size:10.0pt; font-family:Verdana">Creating a normal table works fine, but creating a table with subqueries is giving me “permission denied”</span></font><pclass="MsoNormal"><font face="Verdana" size="2"><span style="font-size:10.0pt; font-family:Verdana">Anyone got a clue?</span></font><p class="MsoNormal"><font face="Verdana" size="2"><span style="font-size:10.0pt; font-family:Verdana">P.S. I’m working on PostgreSQL 7.3.2</span></font><p class="MsoNormal"><font face="Verdana" size="2"><spanstyle="font-size:10.0pt; font-family:Verdana"> </span></font><p class="MsoNormal"><font face="Verdana" size="2"><span style="font-size:10.0pt; font-family:Verdana">Thx </span></font><p class="MsoNormal"><font face="Verdana" size="2"><span style="font-size:10.0pt; font-family:Verdana">Pascal</span></font></div>
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