Solved

permission denied on serial

Posted on 2007-03-23
3
1,188 Views
Last Modified: 2008-01-09
while doing an insert in postgresql, I get permission denied on a serial field.  Here is the error:

 /home/familynetwork/cgi-bin/addideas.py
  180 for category in fields["category"]:
  181         cursor.execute("""insert into ideacategories (name,category) values (%s,%s)""",
  182                 (sqlinjection(fields["name"][0]),
  183                 sqlinjection(category)))
  184          
sqlinjection = <function sqlinjection>, fields = {'URL': [''], 'category': ['Advocacy', 'Animals'], 'city': [''], 'contactperson': [''], 'cost': [''], 'country': ['United States'], 'county': [''], 'description': [''], 'differently': [''], 'email': [''], ...}, category = 'Advocacy'

 /usr/lib/python2.3/site-packages/pgdb.py in execute(self=<pgdb.pgdbCursor instance>, operation='insert into ideacategories (name,category) values (%s,%s)', params=('test', 'Advocacy'))
  173                 else:
  174                         # not a list of tuples
  175                         self.executemany(operation, (params,))
  176
  177         def executemany(self, operation, param_seq):
self = <pgdb.pgdbCursor instance>, self.executemany = <bound method pgdbCursor.executemany of <pgdb.pgdbCursor instance>>, operation = 'insert into ideacategories (name,category) values (%s,%s)', params = ('test', 'Advocacy')

 /usr/lib/python2.3/site-packages/pgdb.py in executemany(self=<pgdb.pgdbCursor instance>, operation='insert into ideacategories (name,category) values (%s,%s)', param_seq=(('test', 'Advocacy'),))
  194                                         self.rowcount = -1
  195                 except Error, msg:
  196                         raise DatabaseError, "error '%s' in '%s'" % ( msg, sql )
  197                 except Exception, err:
  198                         raise OperationalError, "internal error in '%s': %s" % (sql,err)
global DatabaseError = <class pg.DatabaseError>, msg = <pg.ProgrammingError instance>, sql = "insert into ideacategories (name,category) values ('test','Advocacy')"

DatabaseError: error 'ERROR: permission denied for sequence ideacategories_categoryid_seq ' in 'insert into ideacategories (name,category) values ('test','Advocacy')'
      args = ("error 'ERROR: permission denied for sequence id...ories (name,category) values ('test','Advocacy')'",)

/home/familynetwork/logs/tracebacks/tmpIye7to.html contains the description of this error.


The table is:



create table ideacategories (
      categoryid      serial,
      name            varchar(100),
      category      varchar(100)
      ) with oids


some permissions:
CREATE USER addidea;
GRANT SELECT on banips to addidea;
GRANT INSERT on banips to addidea;
GRANT SELECT on accounts to addidea;
GRANT SELECT on ideas to addidea;
GRANT INSERT on ideas to addidea;
GRANT ALL on ideacategories to addidea;

How do I e get by the error.
0
Comment
Question by:astar666
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
earth man2 earned 500 total points
ID: 18784419
treacle=> create table ideacategories (
treacle(>       categoryid      serial,
treacle(>       name            varchar(100),
treacle(>       category      varchar(100)
treacle(>       ) with oids
treacle-> ;
NOTICE:  CREATE TABLE will create implicit sequence "ideacategories_categoryid_seq" for serial column "ideacategories.categoryid"
CREATE TABLE
treacle=>

therefore try
grant select on ideacategories_categoryid_seq to addidea;
0
 
LVL 22

Expert Comment

by:earth man2
ID: 18784430
PS You probably should define table using primary key clause ie
create table ideacategories (
      categoryid      serial primary key,
      name            varchar(100),
      category      varchar(100)
      ) without oids;
0
 

Author Comment

by:astar666
ID: 18786672
took grant all to work
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Good documentation 1 193
Need help with query for Pervasive 2 124
vcenter 6 u2 install question 1 128
postgresql problem - script to create tables does not run 8 86
Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: http://www.postgresql.org/ (http://www.postgresql.org/) This requires some add-o…
Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question