After talking to Crell and reviewing the issue, I think the proposed schama change for fixing http://drupal.org/node/220064 should not be backported to D5 and D6.

The issue with a backport is that doing so will change the bid/delta value that themers rely on.

So attached here is the original block_box_get() patch. It uses a CAST to reconcile the issue on pgSQL 8.2.3+

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

agentrickard’s picture

FileSize
483 bytes

There is (perhaps) a simpler way to fix this.

David_Rothstein’s picture

Title: D6 / D5 JOIN with mixed data types fails on pgsql 8.3 » JOIN with mixed data types fails on pgsql 8.3
Version: 6.2 » 7.x-dev
Priority: Normal » Critical

Oops, it looks like the wrong patch was copied over from the other issue. Here is the correct patch (from http://drupal.org/node/220064#comment-827368). This patch seems to work, and the reasons why it should be OK are discussed at http://drupal.org/node/220064#comment-827364... however, it needs one more reviewer before it's RTBC.

Also, if the JOIN really does turn out to be unnecessary, then it shouldn't be in 7.x either, so let's start there and then backport...

David_Rothstein’s picture

FileSize
1.56 KB

I attached the patch and then it disappeared... so here it is again ;)

agentrickard’s picture

Version: 7.x-dev » 6.2

This is NOT the D7 patch.

David_Rothstein’s picture

Version: 6.2 » 6.x-dev

Both this and http://drupal.org/node/220064 can go into D7; they don't conflict with each other at all. The reason for the patch here is that it's an unnecessary database JOIN that serves no purpose, that's all (in addition to the critical bug).

However, it's definitely much more time-sensitive for D6, so I suppose we can leave it here and then it can be backported ("forwardported"?) to D7 later...

agentrickard’s picture

Right, but we separated the issues because the more complex fix in http://drupal.org/node/220064 is not appropriate for D5 or D6, since it introduces API changes (however slight) for themers.

The code here should be part of the other, larger patch for D7.

drupallfm’s picture

Status: Needs review » Reviewed & tested by the community

Tested the:

#3
David_Rothstein - May 20, 2008 - 15:18

I attached the patch and then it disappeared... so here it is again ;)

Attachment Size
block-box-get.patch 1.56 KB

And it worked, everything seems ok now.
(and the sql statement appears to be more "cleaner" and optimized)

Thks

drupallfm’s picture

I know that this may not belong to this issue, but is regarding pgsql 8.3

please see this http://drupal.org/node/263737

Damien Tournoud’s picture

#263737 has nothing to do with this, but is another critical bug for PostgreSQL (that definitely needs more testers).

Paul Natsuo Kishimoto’s picture

Tested #3, which fixes the bug for me. I can now access /admin/build/block/configure/block/[bid] without errors. My platform is:

  • Drupal 6.2
  • PostgreSQL 8.3.1-1
  • Apache 2.2.8-1ubuntu0.1
  • Ubuntu 8.04

Per David_Rothstein's remark at http://drupal.org/node/220064#comment-850768 this seems to be RTBC.

Thanks for all the effort in #220064: Ensure block delta is class safe and this issue to improve PostgreSQL support!

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Committed to Drupal 6, thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

David_Rothstein’s picture

Version: 6.x-dev » 5.x-dev
Status: Closed (fixed) » Reviewed & tested by the community
FileSize
1.23 KB

Oops, this one was supposed to go into Drupal 5.x too.

Attached is the patch for 5.x; the functions that use this code are essentially the same in 5.x and 6.x, and I have tested that admin-created blocks still work fine after this patch. So I think it's RTBC.

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 5.x.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

k4ml’s picture

FileSize
659 bytes

I ran into this again today. Running Drupal 5.14 with PostgreSQL 8.3.3. The previous patch in #13 still use delta = %d in block_box_delete_submit function. I've check the schema and it's a varchar and hence the error when deleting the block.

\d blocks
                              Table "public.blocks"
   Column   |          Type          |                 Modifiers                  
------------+------------------------+--------------------------------------------
 module     | character varying(64)  | not null default ''::character varying
 delta      | character varying(32)  | not null default '0'::character varying
 theme      | character varying(255) | not null default ''::character varying

The code suppose to be:-

db_query("DELETE FROM {blocks} WHERE module = 'block' AND delta = '%s'", $form_values['bid']);

I try to run update.php in case there's schema changes but no update available from 5.14 upgrade. To reproduce, I just add a new block through admin/build/block and then delete the block. The block is deleted but an error message displayed:-

warning: pg_query() [function.pg-query]: Query failed: ERROR: operator does not exist: character varying = integer LINE 1: DELETE FROM blocks WHERE module = 'block' AND delta = 24 ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
David_Rothstein’s picture

Status: Closed (fixed) » Reviewed & tested by the community

Thanks! I verified that the patch makes sense and works (and also verified that this issue is limited to Drupal 5.x only).

As a tip for the future, please set issues to 'patch (code needs review)' when you provide a patch that is ready for review. A lot of people don't pay attention to an issue if it's still marked as 'closed'...

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 5.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.