From: | Scott Marlowe <smarlowe(at)g2switchworks(dot)com> |
---|---|
To: | Jon Horsman <horshaq(at)gmail(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Permission denied for sequece... |
Date: | 2006-08-21 20:55:02 |
Message-ID: | 1156193701.1090.13.camel@state.g2switchworks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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...
From | Date | Subject | |
---|---|---|---|
Next Message | Jon Horsman | 2006-08-21 22:27:21 | Re: Permission denied for sequece... |
Previous Message | Jon Horsman | 2006-08-21 19:03:42 | Permission denied for sequece... |