pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <smarlowe@g2switchworks.com>
To: Jon Horsman <horshaq@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Permission denied for sequece...
Date: Mon, 21 Aug 2006 15:55:02 -0500
Message-ID: <1156193701.1090.13.camel@state.g2switchworks.com> (raw)
In-Reply-To: <4f4c2a010608211203j6591249cifc9c0a793183aee@mail.gmail.com>
References: <4f4c2a010608211203j6591249cifc9c0a793183aee@mail.gmail.com>

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...



view thread (4+ messages)  latest in thread

Message-ID: <1156193701.1090.13.camel@state.g2switchworks.com>
Permalink:  ../1156193701.1090.13.camel@state.g2switchworks.com/
Also on:    postgresql.org/message-id/1156193701.1090.13.camel@state.g2switchworks.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: smarlowe@g2switchworks.com, horshaq@gmail.com
  Subject: Re: Permission denied for sequece...
  In-Reply-To: <1156193701.1090.13.camel@state.g2switchworks.com>
  References: <4f4c2a010608211203j6591249cifc9c0a793183aee@mail.gmail.com> <1156193701.1090.13.camel@state.g2switchworks.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox