Solved

permission denied on serial

Posted on 2007-03-23
3
1,187 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
  • 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 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