Re: problem inserting with sequence
От | Richard Huxton |
---|---|
Тема | Re: problem inserting with sequence |
Дата | |
Msg-id | 42E8D721.3020203@archonet.com обсуждение исходный текст |
Ответ на | problem inserting with sequence (germ germ <super_code_monkey@yahoo.com>) |
Список | 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
В списке pgsql-general по дате отправления: