With Subscriptions enabled, on a Drupal 7.latest, using PostgreSQL 9.3.latest, when a new user tries to register for the site via users/register, its throwing a PDO SQL fault in subscriptions_user_insert().

the error report reads...
PDOException: SQLSTATE[55000]: Object not in prerequisite state: 7 ERROR: currval of sequence "subscriptions_sid_seq" is not yet defined in this session: INSERT INTO subscriptions (module, field, value, send_interval, author_uid, send_updates, send_comments, recipient_uid) SELECT s.module AS module, s.field AS field, s.value AS value, s.send_interval AS send_interval, s.author_uid AS author_uid, s.send_updates AS send_updates, s.send_comments AS send_comments, 432 AS recipient_uid FROM subscriptions s WHERE (s.recipient_uid IN (:db_condition_placeholder_0)) ; Array ( ) in subscriptions_user_insert() (line 336 of /home/observers/drupal-7.28/sites/all/modules/subscriptions/subscriptions.module).

but the Postgres error log says the error query is actually SELECT CURRVAL('subscriptions_sid_seq');

currval() can only be used inside a transaction after nextval() has been invoked. I suspect the drupal data engine is trying to retrieve the value of subscriptions.sid after the above listed INSERT, instead of querying it like that, it should have used INSERT INTO.... RETURNING sid; As I don't see that reference to CURRVAL() anywhere in subscriptions_user_inser(), it must be getting generated by the Drupal ORM, which I don't really understand.

I've had to disable Subscriptions for now as otherwise no users can register.

Comments

pierce’s picture

ok, the current -dev version of Subscriptions fixes this. There's a 'closed' bug saying much the same, but something that's not in RELEASE state isn't closed in my book.

salvis’s picture

Priority: Major » Normal
Status: Active » Closed (duplicate)

Issues are set to "Fixed" when the fix is committed to the repository, and they go to "Closed (fixed)" automatically after a certain time. Please try the -dev version.

Your 'book' is not part of this procedure.