From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | germ germ <super_code_monkey(at)yahoo(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: problem inserting with sequence |
Date: | 2005-07-28 13:01:21 |
Message-ID: | 42E8D721.3020203@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
germ germ wrote:
> I have been trying to figure out why I can't insert
> into a table and I think it has something to do with
> the sequnce.
>
> I am able to use able to properly insert into the
> table using the the shell, but I am not able to insert
> using a php script:
>
> INSERT INTO requests (time_stamp, req_num,
> recommended_by) VALUES (now(),
> nextval('requests_req_num_seq'), 'foo');
>
> Here is the schema I'm using:
> DROP SEQUENCE requests_req_num_seq;
> DROP TABLE requests;
>
> CREATE SEQUENCE requests_req_num_seq INCREMENT BY 1
> START WITH 1000;
>
> CREATE TABLE requests (
> time_stamp timestamp PRIMARY KEY DEFAULT 'now',
> req_num integer DEFAULT
> nextval('acq_requests_req_num_seq') NOT NULL,
> recommended_by varchar(35) NOT NULL
> );
> GRANT ALL ON requests TO wwwrun, postgres;
Check you server logs and it should tell you why. Actually, check the
error code in your PHP and it should tell you why.
My immediate guess - you haven't granted permission to the sequence for
user "wwwrun".
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-07-28 13:08:01 | Re: problem inserting with sequence |
Previous Message | Gnanavel S | 2005-07-28 12:46:44 | Re: problem inserting with sequence |