Update #6003 fails on PostgreSQL

koens - February 18, 2009 - 15:00
Project:Frequently Asked Questions
Version:6.x-1.8
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

When installing 6.x-1.8 I have noticed the following warnings:

    * warning: pg_query(): Query failed: ERROR: column "detailed_question" contains null values in /srv/www/htdocs/includes/database.pgsql.inc on line 139.
    * user warning: query: ALTER TABLE faq_questions ALTER detailed_question SET NOT NULL in /srv/www/htdocs/includes/database.pgsql.inc on line 697.

I'm running against a PostgreSQL database, but when I see:

The following queries were executed
faq module
Update #6003

    * ALTER TABLE {faq_questions} ADD COLUMN detailed_question text
    * Failed: ALTER TABLE {faq_questions} ALTER detailed_question SET NOT NULL
    * UPDATE {faq_questions} SET detailed_question = question

I would think it is better to first do the UPDATE, and then SET NOT NULL, regardless of the RDBMS.

#1

stella - June 24, 2009 - 09:55
Category:bug report» support request
Status:active» fixed

Hmm I'm not sure this is a faq module problem. Update #6003 does the following:

  db_add_field($ret, 'faq_questions', 'detailed_question', array('type' => 'text', 'size' => 'normal', 'not null' => TRUE, 'default' => ''));
  $ret[] = update_sql("UPDATE {faq_questions} SET detailed_question = question");

So it uses Drupal's db_add_field() function to add the field. I can't change the order, as (a) the column has to exist before I can set its contents and (b) the set not null is actually done in db_add_field(). This might be more of an issue for Drupal.

Cheers,
Stella

#2

System Message - July 8, 2009 - 10:00
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.