SQL errors on editing Twitter Accounts
| Project: | |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
warning: pg_query() [function.pg-query]: Query failed: ERROR: null value in column "last_refresh" violates not-null constraint in /home/drupal6/drupal-6.4/includes/database.pgsql.inc on line 138.
user warning: query: INSERT INTO twitter_account (twitter_uid, screen_name, name, description, location, followers_count, profile_image_url, url, protected) VALUES (778337, 'br3nda', 'Brenda Wallace', 'Dreams of pirates with bluetooth eye patches and only programmes languages that begin with P', 'wellington, new zealand', 612, 'http://s3.amazonaws.com/twitter_production/profile_images/52451498/bpcomp_Ninja2_normal_normal.png', 'http://coffee.geek.nz', 0) in /home/drupal6/drupal-6.4/includes/common.inc on line 3318.

#1
I ran this SQL to get it going... but it's not a real fix:
ALTER TABLE twitter_account alter last_refresh drop not null;
#2
I ran into this as well. The problem is that the last_refresh column
for the twitter_account table is defined as a NOT NULL column with
no DEFAULT value. The twitter_user_save() function that writes the
record via drupal_write_record() does have a value for last_refresh
to pass to the drupal_write_record() call.
In MySQL you will still be OK because MySQL -when not in strict mode-
has implied default values for certain column types that allow you to
not have to define default values but PostgreSQL does not have
implied defaults.
See these pages for more detail:
http://drupal.org/node/159329
http://drupal.org/node/159330
The schema for the twitter module for the twitter_account table can
be updated to set a DEFAULT value for the field or the twitter_user_save()
function can be setup to add a default value for the last_access field
before the call to drupal_write_record() occurs.
Which approach to take is up to the developers once they read this
issue.
#3
related to #379678: No data added to {twitter_account}
#4
Bump - I ran into this issue today too.
Thanks,
Curtis.
#5
I ran into this issue because our environment runs MySQL in strict mode. Attached is the patch I applied to fix the problem. It adds a default value of 0 to the last_refresh field.
#6
Fixed. Thanks!
#7
Automatically closed -- issue fixed for 2 weeks with no activity.