Image toolkit
No image toolkits found. Drupal will use PHP's built-in GD library for image handling.

Warning: pg_query(): Query failed: ERROR: invalid input syntax for type bytea in d:\highspeed\htdocs\drupal\drupal-5.0-beta1\includes\database.pgsql.inc on line 125

Warning: ERROR: invalid input syntax for type bytea query: UPDATE cache SET data = 'a:11:{s:13:"theme_default";s:7:"garland";s:13:"filter_html_1";i:1;s:18:"node_options_forum";a:1:{i:0;s:6:"status";}s:17:"menu_primary_menu";i:2;s:19:"menu_secondary_menu";i:2;s:15:"install_profile";s:7:"default";s:18:"drupal_private_key";s:64:"d008c9d88df1c4ba8bf8daa004519e8ddb1c0be8d187121a211aa1f73c0802ac";s:11:"admin_theme";s:1:"0";s:2:"op";s:18:"Save configuration";s:10:"form_token";s:32:"4cb2259f14556d69854085d06a3dc7c0";s:19:"file_directory_temp";s:15:"c:\\windows\\temp";}', created = 1162412408, expire = 0, headers = '' WHERE cid = 'variables' in d:\highspeed\htdocs\drupal\drupal-5.0-beta1\includes\database.pgsql.inc on line 144

Warning: pg_affected_rows(): supplied argument is not a valid PostgreSQL result resource in d:\highspeed\htdocs\drupal\drupal-5.0-beta1\includes\database.pgsql.inc on line 241

Comments

doq’s picture

now these errors appear on every page. Just installed, haven't changed anything. Just themes AFAIR.

sime’s picture

Component: base system » database system

flagging as db issue - sammys?

Jo Wouters’s picture

StatusFileSize
new777 bytes

I'm no expert, and I don't have a Postgres installation to test this, but I think the problem is in /includes/cache.inc

<?php
 function cache_set($cid, $table = 'cache', $data, $expire = CACHE_PERMANENT, $headers = NULL) {
  db_lock_table($table);
  db_query("UPDATE {%s} SET data = '%s', created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $table, $data, time(), $expire, $headers, $cid);
  ...
?>

fills the bytea-field 'data' with a string.

I think we should add $data = db_encode_blob($data); before we do the update.
In cache_get we do a $cache->data = db_decode_blob($cache->data);

The db_encode_blob might have gone lost when cache.inc was moved out of bootstrap.inc (for a while %b was used)

Attached you can find the patch that add this line
(CAUTION: I did not test this)

Jo Wouters’s picture

Status: Active » Needs review
doq’s picture

Status: Needs review » Needs work

so why just not using %b for 'data'?

havran’s picture

Jo Wouters’s picture

StatusFileSize
new1.14 KB

@doq: you are right: %b is better.

I addded a patch but as I understand from http://drupal.org/node/92503 , this might not be a complete solution ? Is this issue a duplicate from 92503 ?
(caution: Since I don't have Postgres, I couldn't test the patch)

doq’s picture

Status: Needs work » Needs review

Patch is good.

doq’s picture

Title: go to ?q=admin/settings/image-toolkit & pg errors received » inproper BLOBs handing

Patch is good.

havran’s picture

I agree patch is good. I have tried patch second time - patch is god and working. But now is here new problem - with negative value which is return from function timer_read('page') in function statistics_init() (in statistics.module).

doq’s picture

hmmm. Have you tried with/without patch?

I can't imaging that it can break smth in timer_read() :)

havran’s picture

Without patch caching don't work but there is no error like this 'read_timer' - with patch caching working perfect, but there is now problem with statistics.module. If i disable this module all seems working ok.

Jo Wouters’s picture

(havran has created a new issue for the timer_read problem: http://drupal.org/node/93491 )

sammys’s picture

Assigned: Unassigned » sammys
Status: Needs review » Reviewed & tested by the community

Patch cache_set_pgsql_error_1.patch.txt works ok on PostgreSQL. RTBC!

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)