Re: PostgreSQL and select nextval
| From: | brian | Date: | Sun, 12 Aug 2007 14:33:49 +0000 |
| Subject: | Re: PostgreSQL and select nextval | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-260737@lists.php.net to get a copy of this message | ||
Alain Roger wrote:
Hi, I'm getting an error message when i run the following SQL request : $sql = "INSERT INTO tmp_importedxls (rec_id, publisher) VALUES (SELECT nextval('tmp_importedxls_rec_id_seq'),'$pb')"; Error in SQL query: ERROR: syntax error at or near "SELECT" LINE 2: VALUES (SELECT nextval('tmp_importedxls_rec_id_seq'),' ^ I have the feeling that we can not use the select nextval(...) SQL request in an INSERT INTO one under PHP. Is it true?If rec_id is a SERIAL it will increment itself: INSERT INTO tmp_importedxls (publisher) VALUES ('$pb'); brian