[imp] ERROR: column "pref_value" is of type text but expression is of type boolean

marco at eduktodos.dyndns.org marco at eduktodos.dyndns.org
Tue Jun 1 14:39:56 PDT 2004


Peter Ahearn wrote:

Hi All:

I've searched both the internet and the mailing lists extensively and
haven't found an answer to the problem I'm having so I thought I'd see if
anyone has any insight. I did find the same question posted a while ago but
with no responses. Anyway here's what's happening:

I'm running Horde 2.2.4 and Imp 3.2.2 on a Redhat 7.0 box, php-pgsql
4.2.2-8.0.5, postgresql 7.4-0.2PGDG. Everything works great when I don't try
to enable user preferences, but when I do upon login I get the error
message:

A fatal error has occurred:
DB Error: unknown error
[line 341 of /var/www/html/horde/lib/Prefs/sql.php]
Details have been logged for the administrator.

...the output of the postgres log is:

ERROR: column "pref_value" is of type text but expression is of type
boolean
HINT: You will need to rewrite or cast the expression.
ERROR: column "pref_value" is of type text but expression is of type
boolean
HINT: You will need to rewrite or cast the expression.

The person who posted an equivalent problem also posted a patch involving
casting delhide to a string in mailbox.php, but this does not fix the
problem for me.

Does anyone know the solution to this problem, have this problem, or have
any helpful suggestions? I'm at the end of my rope with this.

Thanks in advance for any information,

-peter 


Recently y had the same problem and I believe that it ownes to the version of
PHP that intoduces boolean types since version 4. 

PHP does not require (or support) explicit type definition in variable
declaration; a variable's type is determined by the context in which that
variable is used. That is to say, if you assign a string value to variable $var,
$var becomes a string. If you then assign an integer value to $var, it becomes
an integer.

So, I solve the problem with sum a null string to the variable
$this->getValue($name) defined in /var/www/html/horde/lib/Prefs/sql.php

Thet is, I change the lines that say:
$query .= 'set pref_value = ' . $this->db->quote($this->getValue($name));
with
$query .= 'set pref_value = ' . $this->db->quote(($this->getValue($name))+"");

that means:
$this->getValue($name)   is a boolean type
($this->getValue($name))+""  is now text type


and the query to the database has no problem.

Marco

___________________________________________________
Correo Electrónico, Talleres Estudiantiles Ciencias.


More information about the imp mailing list