X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id C72239FB1DE for ; Mon, 21 Aug 2006 17:55:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 69785-04 for ; Mon, 21 Aug 2006 20:55:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id C4D5F9FAE4E for ; Mon, 21 Aug 2006 17:55:07 -0300 (ADT) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Mon, 21 Aug 2006 20:55:02 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 21 Aug 2006 15:55:02 -0500 Subject: Re: Permission denied for sequece... From: Scott Marlowe To: Jon Horsman Cc: pgsql-jdbc@postgresql.org In-Reply-To: <4f4c2a010608211203j6591249cifc9c0a793183aee@mail.gmail.com> References: <4f4c2a010608211203j6591249cifc9c0a793183aee@mail.gmail.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1156193701.1090.13.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 21 Aug 2006 15:55:02 -0500 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=SPF_PASS, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200608/91 X-Sequence-Number: 15618 On Mon, 2006-08-21 at 14:03, Jon Horsman wrote: > Hey, > > I'm in the process of porting an app from MySQL to PostgreSQL and am > pretty new with PostgreSQL and am having permission problems. > > First, a little background info. > - The postmaster is set to startup with -i and i'm able to actually > connect without an exception. > - I've added the following lines to the pg_hba.conf files (for testing purposes) > local all all trust > host all all 127.0.0.1 255.255.255.255 trust > > I create my db, as follows: > createdb testdb > > then i log into psql and run the following > CREATE USER testuser PASSWORD 'default'; > GRANT ALL ON DATABASE testdb TO testuser; > GRANT ALL ON [my table names] TO testuser; > > In my app i connect to the db with the following, which is run without issue. > connection = DriverManager.getConnection("jdbc:postgresql:testdb", > "testuser", "default"); > > I then call the following insert > INSERT INTO Property (Name,Value) VALUES ("some name", "some value") > > and get the following error > > org.postgresql.util.PSQLException: ERROR: permission denied for > sequence property_propertyid_seq > > The sql used to create the property table is > > CREATE TABLE Property > (PropertyID SERIAL PRIMARY KEY, > Name VARCHAR(64) UNIQUE NOT NULL, > Value VARCHAR(255) NOT NULL); > > Can someone tell me what would cause this error message to occur and > suggest ways that i could fix it? run psql to your db and do a \d on that table. You should see something like this: Column | Type | Modifiers --------+---------+------------------------------------------------------ id | integer | not null default nextval('public.real_id_seq'::text) Note that my table, real, has a sequence named read_id_seq. You need to grant all on that as well...