After running update.php the following errors are displayed when adding a Node Queue

* warning: pg_query() [function.pg-query]: Query failed: ERROR: relation "nodequeue_subqueue_sqid_seq" does not exist in /home/anthony/domains/anthony.thrillist-dev.com/public_html/thrilldrupal/includes/database.pgsql.inc on line 125.
* user warning: query: SELECT nextval('nodequeue_subqueue_sqid_seq') in /home/anthony/domains/anthony.thrillist-dev.com/public_html/thrilldrupal/includes/database.pgsql.inc on line 144.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: relation "nodequeue_subqueue" does not exist in /home/anthony/domains/anthony.thrillist-dev.com/public_html/thrilldrupal/includes/database.pgsql.inc on line 125.
* user warning: query: INSERT INTO nodequeue_subqueue (qid, sqid, reference, title) VALUES (1, 0, '1', 'Test Node Queue') in /home/anthony/domains/anthony.thrillist-dev.com/public_html/thrilldrupal/includes/database.pgsql.inc on line 144.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: relation "nodequeue_subqueue" does not exist in /home/anthony/domains/anthony.thrillist-dev.com/public_html/thrilldrupal/includes/database.pgsql.inc on line 125.
* user warning: query: SELECT q.*, COUNT(s.sqid) AS subqueues FROM nodequeue_queue q LEFT JOIN nodequeue_subqueue s ON q.qid = s.qid WHERE q.qid IN (1) GROUP BY q.qid in /home/anthony/domains/anthony.thrillist-dev.com/public_html/thrilldrupal/includes/database.pgsql.inc on line 144.

Look around in the install file and I see that the table never gets created in the PgSQL case. I have modified the install file to include the following in the PgSQL case under nodequeue_install();

The new section looks like:

        // anthony [at] thrillist dot com matches mysql/mysqli cases
        // Subqueues are minor queues that inherit all of the properties of
        // the parent queue. A parent queue must have at least 1 subqueue
        // to do anything. Reference is for the use of whatever is creating
        // the subqueues in order to link it to some other ID easily.
        db_query("CREATE TABLE {nodequeue_subqueue} (
          sqid integer PRIMARY KEY,
          qid integer NOT NULL,
          reference varchar(255) default 0,
          title varchar(255) default ''
        )");
        db_query("CREATE INDEX {nodequeue_subqueue}_qid_idx ON {nodequeue_subqueue} (qid)");
        db_query("CREATE INDEX {nodequeue_subqueue}reference_idx ON {nodequeue_subqueue} (reference)");
        db_query("CREATE INDEX {nodequeue_subqueue}_title_idx ON {nodequeue_subqueue} (title)");
        // end of my custom PgSQL

Also the following line:

        db_query("CREATE SEQUENCE nodequeue_queue_qid_seq INCREMENT 1 START 1");

has turned into:

        db_query("CREATE SEQUENCE nodequeue_queue_qid_seq INCREMENT 1 START 1");
        db_query("CREATE SEQUENCE nodequeue_subqueue_sqid_seq INCREMENT 1 START 1"); // added by me

I have tested these changes in my Drupal environment and work 100%. I guess this has not been reported before due to the lack of PgSQL users, hopefully that will change.

CommentFileSizeAuthor
#1 nodequeue-269459-2.pqsql_.patch7.71 KBtelex-1

Comments

telex-1’s picture

Status: Active » Needs work
StatusFileSize
new7.71 KB

I ran into this problem too and there's also another one with several SELECT queries in 'nodequeue.module'. Without really understanding the database stuff, the difference between PgSQL and MySQL and exact purpose of these queries, I was able to somehow tweak them so the module now works with PgSQL at least without error messages. I briefly tested the patch also on MySQL based installation and it seems to work fine too.. The queries are probably not optimal, so you may experience slower performance - the code really needs some expert work.. The patch is against 5.x-2.x.-dev. I also rolled in the code from this issue: #269541: PgSQL for insert statements.

Gijs’s picture

This patch failes on my Debian system with Drupal 5-8

patch nodequeue.install nodequeue-269459-2.pqsql _.patch
patching file nodequeue.install
patching file nodequeue.module
Hunk #1 FAILED at 20.
Hunk #2 succeeded at 1096 (offset 16 lines).
Hunk #3 succeeded at 1113 (offset 16 lines).
Hunk #4 succeeded at 1562 (offset 25 lines).
Hunk #5 succeeded at 1625 (offset 25 lines).
Hunk #6 succeeded at 1677 (offset 25 lines).
Hunk #7 succeeded at 1745 (offset 25 lines).
1 out of 7 hunks FAILED -- saving rejects to file nodequeue.module.rej

and that reject file says:

*************** function nodequeue_init() {
*** 20,29 ****
if (module_exists('actions')) {
include_once drupal_get_path('module', 'nodequeue') . '/nodequeue.actions.inc';
}
-
- if (module_exists('workflow_ng')) {
- include_once drupal_get_path('module', 'nodequeue') . '/nodequeue.workflow_ng.inc';
- }

if (module_exists('views')) {
include_once drupal_get_path('module', 'nodequeue') . '/nodequeue.views.inc';
--- 20,29 ----
if (module_exists('actions')) {
include_once drupal_get_path('module', 'nodequeue') . '/nodequeue.actions.inc';
}
+
+ if (module_exists('workflow_ng')) {
+ include_once drupal_get_path('module', 'nodequeue') . '/nodequeue.workflow_ng.inc';
+ }

if (module_exists('views')) {
include_once drupal_get_path('module', 'nodequeue') . '/nodequeue.views.inc';

The error now (still) reported by site:

    * warning: pg_query() [function.pg-query]: Query failed: ERROR: relation "nodequeue_subqueue" does not exist in /usr/share/drupal-5.8/includes/database.pgsql.inc on line 125.
    * user warning: query: SELECT nodequeue_subqueue.title, nodequeue_subqueue.reference, count(node.nid) AS num_nodes, nodequeue_subqueue.title AS nodequeue_subqueue_title FROM node node LEFT JOIN nodequeue_nodes nodequeue_nodes ON node.nid = nodequeue_nodes.nid LEFT JOIN nodequeue_subqueue nodequeue_subqueue ON nodequeue_nodes.sqid = nodequeue_subqueue.sqid WHERE (nodequeue_subqueue.reference IS NOT NULL) AND (nodequeue_subqueue.qid = -1) GROUP BY nodequeue_subqueue.title, nodequeue_subqueue_title ORDER BY nodequeue_subqueue_title ASC LIMIT 5 OFFSET 0 in /usr/share/drupal-5.8/includes/database.pgsql.inc on line 144.

socki’s picture

You might check out this thread.. its possible you are having the same error... and the same solution will work:

Different version of the module, but seems same error with Postgres.

#286918: Schema mismatch errors reported by schema.module

ezra-g’s picture

Status: Needs work » Closed (duplicate)

This is a duplicate of #290969: Postgres compatibility. Let's continue working over there.