Postgres compatibility

socki - August 4, 2008 - 15:53
Project:Nodequeue
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs work
Issue tags:postgres
Description

Hey,

There are a few queries that don't work properly in Postgres because they take advantage of some of MySQL's leniency of SQL.

Basically, the group bys on Select * fail in Postgres.

This patch will correct them, as well as one other minor bug fix.

AttachmentSize
nodequeue_pgsql.patch3.96 KB

#1

cwoodruf - August 4, 2008 - 16:10

Also the insert statement in nodequeue_arrange_subqueue_form_submit needs to be broken up into individual insert statements. I"m using postgresql 7.4.x.

I missed a couple of the other issues you dug up and did the field list slightly differently. I did do basic testing of these changes on both mysql and postgres.

Cheers

Cal

PS I've included an ed style diff and the full file can be found at http://placeofdreams.org/nodequeue.module

AttachmentSize
nodequeue.diff 1.37 KB

#2

socki - August 8, 2008 - 21:44

Thanks Cal.

You identified a couple items I had missed. I've noticed some additional issues when using actions which i'm including with this patch.

This should include all the changes we've both discussed plus those for actions.

-T

AttachmentSize
nodequeue_pgsql.patch 7.54 KB

#3

ezra-g - August 9, 2008 - 05:06

@cwoodruf, or another Postgres user, can you confirm that the revised patch in #2 is RTBC?

#4

cedarm - November 13, 2008 - 02:32
Version:6.x-2.0-rc1» 6.x-2.0-rc3
Priority:normal» critical

As a postgres user I confirm that these changes work.
Rerolled patch from #2 against CVS HEAD. This reroll also applies cleanly to nodequeue-6.x-2.0-rc3 (offset of -1).

The changes to nodequeue.actions.inc are already in HEAD, as well as hunk 4 of nodequeue.module in the patch from #2, so these are not included in the reroll.

Changing priority to critical as the module is unusable for postgres users without this patch.

AttachmentSize
nodequeue-290969-4.patch 4.27 KB

#5

tuffnatty - December 1, 2008 - 11:09

subscribing

#6

ezra-g - December 23, 2008 - 19:31

Does this patch make #269459: PgSQL unnecessary?

#7

ezra-g - December 24, 2008 - 21:30

It would be great if someone with postgres familiarity could comment on the relation between this patch and the following additional postgres issues:
#286918: Schema mismatch errors reported by schema.module
#269541: PgSQL for insert statements.

Should these other issues be marked as dupes? Does this patch need work? Leaving as CNR.

#8

cedarm - January 7, 2009 - 01:40

It looks like all three are related. There seems to be two separate issues, but some mix e two in the same issue. The first is just the syntax of SQL statements, which I think my patch addresses completely (at least in the main module).

The second issue looks like the nodequeue_subqueue table is missing from D5 for pgsql. The code supplied in #269459: PgSQL looks like it address (only) this issue.

Between a proper patch for #269459, and a reroll or rework of this patch for D5, all of these issues can probably be resolved.

#9

ezra-g - January 8, 2009 - 22:23

It looks like this patch changes the insert for saving new values into the nodequeue_nodes table from a single insert per-queue to one insert per-node. On a site with a lot of queues, that could add up to many additional queries. Is there any alternative to that?

#10

drewish - January 13, 2009 - 00:38

Seems like the INSERT INTO {nodequeue_nodes}... would be better done via drupal_write_record()...

the rest of the query changes look correct to me.

#11

groklem - June 22, 2009 - 00:12

The above patch worked for me however the node names were not getting displayed as a query was failing

* warning: pg_query() [function.pg-query]: Query failed: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list in database.pgsql.inc on line 139.
* user warning: query: SELECT DISTINCT(n.nid) FROM node n LEFT JOIN nodequeue_nodes nq ON nq.nid = n.nid WHERE nq.sqid = 2 ORDER BY nq.position ASC in nodequeue.module on line 1046.

Changing line 1046 in nodequeue.module fixed this issue:
$query_restricted = db_query(db_rewrite_sql("SELECT n.nid FROM {node} n LEFT JOIN {nodequeue_nodes} nq ON nq.nid = n.nid WHERE nq.sqid = %d$node_status_sql GROUP BY n.nid, nq.position ORDER BY nq.position $order"), $sqid);

#12

ezra-g - June 23, 2009 - 16:49
Status:needs review» needs work

Thanks for pointing this out. Could you submit this change as a patch?

#13

groklem - July 30, 2009 - 02:42

The patch in this thread breaks latest version of nodequeue with postgres. Here is a patch that should work with postgres and nodequeue 2.3

AttachmentSize
nodequeue-2.3-pgsql.patch 3.88 KB

#14

jamespharaoh - August 10, 2009 - 10:40

Just rolled my own patch using subqueries. Seems fairly similar to the others here otherwise. I am pretty sure this should work in MySQL 4.1 and up.

Does anyone know why PostgreSQL support has not been merged into nodequeue proper? This thread seems to have been going for ages.

AttachmentSize
nodequeue.patch 3.27 KB

#15

ezra-g - August 17, 2009 - 22:51

This no longer applies.

#16

ezra-g - August 27, 2009 - 17:13

Marked http://drupal.org/node/269459 as a duplicate.

#17

groklem - September 16, 2009 - 02:25

I struck an issue with nodequeue 2.3 and postgres 8.1 on line 1345 there is a db_query that attempts to do multiple inserts in a single statement. Postgres 8.1 fails on this (8.3 is ok).

Here is a patch that should fix this issue with pg8.1

@ezra-g what do you mean by this no longer applies? latest (v2.4 ) nodequeue did not fix the postgres issues in my testing...

AttachmentSize
nodequeue-pg81.patch 1.17 KB

#18

ezra-g - September 16, 2009 - 02:34
Version:6.x-2.0-rc3» 6.x-2.x-dev

No longer applies means a patch no longer applies to the HEAD version of a module.

Also, please roll all of the postgres fixes into a single patch. Thanks!

#19

ezra-g - September 16, 2009 - 02:35

to be more clear, it means the patch cannot be applied, not that the issue is no longer relevant.

#20

lportela - October 14, 2009 - 19:14

Hello.

I applied the modifications outlined in #14 and I generated the patch for the version 6.x-2.x-dev.
I hope it was helpful.

Greetings

Leandro

AttachmentSize
nodequeue-6.x-2.x-postgresql.patch 2.04 KB

#21

lportela - October 23, 2009 - 20:15

Hello.

I added some corrections to my previous patch. I replaced "| |" for "OR" for some queries.

AttachmentSize
nodequeue-6.x-2.x-postgresql_v2.patch 2.29 KB

#22

ezra-g - October 24, 2009 - 16:44

Thanks for the patch. Unfortunately it patch is unreviewable because it was rolled without the cvs diff -up options. Please see http://drupal.org/patch/create.

Also, it doesn't seem to take into account any of the changes in the previous patches.

 
 

Drupal is a registered trademark of Dries Buytaert.