?
Solved

permission denied on serial

Posted on 2007-03-23
3
Medium Priority
?
1,191 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 1000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

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…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

801 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