I am getting this one:

    * warning: pg_query() [function.pg-query]: Query failed: ERROR: operator does not exist: character varying + integer LINE 1: ...ATE counter_data SET counter_value = counter_value+1 WHERE c... ^ HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. in /home/private/mysite/home/mysite/htdocs/includes/database.pgsql.inc on line 139.
    * user warning: ERROR: operator does not exist: character varying + integer LINE 1: ...ATE counter_data SET counter_value = counter_value+1 WHERE c... ^ HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. query: UPDATE counter_data SET counter_value = counter_value+1 WHERE counter_name='site_counter' in /home/private/mysite/home/mysite/htdocs/sites/all/modules/counter/counter.module on line 168.
CommentFileSizeAuthor
#4 counter_install.zip1.19 KBcornelia

Comments

knee’s picture

A quick solution is to change line 167
from

$sql = " UPDATE {counter_data} SET counter_value = counter_value+1 WHERE counter_name='site_counter'";

to

$sql = " UPDATE {counter_data} SET counter_value = counter_value::int+1 WHERE counter_name='site_counter'";

Not the best solution but it does it's work..

janeks’s picture

Thank's!
It works now!

brgds
Janeks

dm_mash’s picture

As counter_value is of varchar type then I guess lines 167-168:

$sql = " UPDATE {counter_data} SET counter_value = counter_value+1 WHERE counter_name='site_counter'";
$results = db_query($sql);

should be changed to something like

$sql = " SELECT counter_value FROM {counter_data} WHERE counter_name='site_counter'";
$res = db_result(db_query($sql));
$res++;
$sql = " UPDATE {counter_data} SET counter_value = '%s' WHERE counter_name='site_counter'";
$results = db_query($sql, $res);

And this is how it looks like in similar UPDATEs later in the code.

BTW what does exactly "Site Counter" value mean? It seems unclear to me.

cornelia’s picture

StatusFileSize
new1.19 KB

I think counter_value should be defined as integer in the database table.

Attached my install script which works well with PostgreSQL 8.4.

Greetings
Conni

drupalnesia’s picture

Fixed. Thanks all for patching and review.

6.x-2.4: Bug fix: PostgreSQL can not accept "counter_data.counter_value + 1" since it is varchar

drupalnesia’s picture

Status: Active » Closed (fixed)

Resolved!

dm_mash’s picture

Title: Problems with PostgreSQL? » PostgreSQL doesn't support INSERT IGNORE
Version: 6.x-2.0 » 6.x-2.6
Status: Closed (fixed) » Active

It results in errors like
query: INSERT IGNORE INTO counter (counter_ip,counter_date,counter_page) VALUES ('192.168.0.1','2010-04-14 14:15:14','/admin/settings/date-time') in /home/www/sites/all/modules/counter/counter.module on line 177.

So 'IGNORE' should appear only in mysql/mysqli case.

drupalnesia’s picture

Title: PostgreSQL doesn't support INSERT IGNORE » Problems with PostgreSQL?
Status: Active » Closed (fixed)

Please don't change the TITLE. The integer issue has been fixed in 6.x-2.4.
6.x-2.4: Bug fix: PostgreSQL can not accept "counter_data.counter_value + 1" since it is varchar

For IGNORE clause problem in PostgreSQL follow this thread http://drupal.org/node/782088