Re: warning: pg_query(): Query failed - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: warning: pg_query(): Query failed
Date
Msg-id 20050106230834.GA24431@wolff.to
Whole thread Raw
In response to warning: pg_query(): Query failed  (Aaron Steele <asteele@berkeley.edu>)
Responses Re: warning: pg_query(): Query failed  (Aaron Steele <asteele@berkeley.edu>)
List pgsql-general
On Thu, Jan 06, 2005 at 14:38:53 -0800,
  Aaron Steele <asteele@berkeley.edu> wrote:
> hi bruno,

Please copy replies to the list so that other people can help and learn
from your problem.

>
> here's the IF() from psql, although i'm not familiar enough to really
> know what to look for. do you see anything obviously wrong here? is
> there a better way to look at the IF() function?
> ........................................................................
> ......................................
> dmapdb=# \df+ if
>
>            List of functions
>  Result data type | Schema | Name | Argument data types | Owner |
> Language |                                         Source code
>                                 | Description
> ------------------+--------+------+---------------------+-------
> +----------
> +-----------------------------------------------------------------------
> -----------------------+-------------
>  text             | public | if   | integer, text, text | dmap  |
> plpgsql  |
> BEGIN
>   IF $1 THEN
>     RETURN $2;
>   END IF;
>   IF NOT $1 THEN
>     RETURN $3;
>   END IF;
> END;

In the php code you showed the following fragment:
IF(l.last_comment_uid,      cu.name,      l.last_comment_name)

I doubt that l.last_comment_uid is a boolean based on its name.
If it isn't this is probably the source of your problem.

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: postgresql-contrib risks?
Next
From: Joe Conway
Date:
Subject: Re: Global/persistent variables