|
List Info
Thread: SELECT IF(COUNT(*)>0,0,1) AS no_children.....
|
|
| SELECT IF(COUNT(*)>0,0,1) AS
no_children..... |

|
2006-01-23 12:21:04 |
Hi,
I'm using head svn from the unstable tree for dbmail.
Backend PostgreSQL.
Frontend IMAP.
When I let my client lookup imap folders it returns this
error:
Jan 23 12:57:32 xi dbmail/imap4d[4438]:
db.c,db_getmailbox_list_result:
db error
Jan 23 12:57:32 xi dbmail/imap4d[4438]: dbpgsql.c, db_query:
Error
executing query [SELECT IF(COUNT(*)>0,0,1) AS no_children
FROM
dbmail_mailboxes WHERE owner_idnr = '3' AND name LIKE
'Verzonden
items/%' ] : [ERROR: function if(boolean, integer, integer)
does not
exist HINT: No function matches the given name and argument
types. You
may need to add explicit type casts. ]
The problem is, that postgresql doesn't have an
"IF" function.
Removing the complet IF statement, everything works OK.
What is the purpose of the IF statement? And if it is
necessary it is
possible to create such a function in pgsql:
CREATE OR REPLACE FUNCTION "if"(integer, integer,
integer)
RETURNS text AS
'
SELECT CASE WHEN ($1<>0) THEN $2 ELSE $3 END;
'
LANGUAGE 'sql';
--
Met vriendelijke groet,
Marc Dirix
_______________________________________________
Dbmail mailing list
Dbmail dbmail.org
htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
|
|
| SELECT IF(COUNT(*)>0,0,1) AS
no_children..... |

|
2006-01-23 12:48:52 |
Further looking at the code:
in function:
db_get_result_bool
return (tmp ? (atoi(tmp) ? 1 : 0) : 0); does actually do the
same
as the IF statement in sql, so removing the function does
look an
obvious way to go.
Kind regards,
Marc
On Mon, Jan 23, 2006 at 01:21:04PM +0100, Marc Dirix wrote:
> Hi,
>
> I'm using head svn from the unstable tree for dbmail.
> Backend PostgreSQL.
> Frontend IMAP.
>
> When I let my client lookup imap folders it returns
this error:
>
> Jan 23 12:57:32 xi dbmail/imap4d[4438]:
db.c,db_getmailbox_list_result:
> db error
> Jan 23 12:57:32 xi dbmail/imap4d[4438]: dbpgsql.c,
db_query: Error
> executing query [SELECT IF(COUNT(*)>0,0,1) AS
no_children FROM
> dbmail_mailboxes WHERE owner_idnr = '3' AND name LIKE
'Verzonden
> items/%' ] : [ERROR: function if(boolean, integer,
integer) does not
> exist HINT: No function matches the given name and
argument types. You
> may need to add explicit type casts. ]
>
>
> The problem is, that postgresql doesn't have an
"IF" function.
>
> Removing the complet IF statement, everything works OK.
> What is the purpose of the IF statement? And if it is
necessary it is
> possible to create such a function in pgsql:
>
> CREATE OR REPLACE FUNCTION "if"(integer,
integer, integer)
> RETURNS text AS
> '
> SELECT CASE WHEN ($1<>0) THEN $2 ELSE $3 END;
> '
> LANGUAGE 'sql';
>
> --
> Met vriendelijke groet,
>
> Marc Dirix
>
> _______________________________________________
> Dbmail mailing list
> Dbmail dbmail.org
> htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
_______________________________________________
Dbmail mailing list
Dbmail dbmail.org
htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
|
|
| SELECT IF(COUNT(*)>0,0,1) AS
no_children..... |

|
2006-01-23 13:17:37 |
I've fixed this. Please try again.
Marc Dirix wrote:
> Further looking at the code:
>
> in function:
> db_get_result_bool
>
> return (tmp ? (atoi(tmp) ? 1 : 0) : 0); does actually
do the same
> as the IF statement in sql, so removing the function
does look an
> obvious way to go.
>
> Kind regards,
>
> Marc
>
>
>
> On Mon, Jan 23, 2006 at 01:21:04PM +0100, Marc Dirix
wrote:
>
>>Hi,
>>
>>I'm using head svn from the unstable tree for
dbmail.
>>Backend PostgreSQL.
>>Frontend IMAP.
>>
>>When I let my client lookup imap folders it returns
this error:
>>
>>Jan 23 12:57:32 xi dbmail/imap4d[4438]:
db.c,db_getmailbox_list_result:
>>db error
>>Jan 23 12:57:32 xi dbmail/imap4d[4438]: dbpgsql.c,
db_query: Error
>>executing query [SELECT IF(COUNT(*)>0,0,1) AS
no_children FROM
>>dbmail_mailboxes WHERE owner_idnr = '3' AND name
LIKE 'Verzonden
>>items/%' ] : [ERROR: function if(boolean, integer,
integer) does not
>>exist HINT: No function matches the given name and
argument types. You
>>may need to add explicit type casts. ]
>>
>>
>>The problem is, that postgresql doesn't have an
"IF" function.
>>
>>Removing the complet IF statement, everything works
OK.
>>What is the purpose of the IF statement? And if it
is necessary it is
>>possible to create such a function in pgsql:
>>
>>CREATE OR REPLACE FUNCTION "if"(integer,
integer, integer)
>>RETURNS text AS
>>'
>> SELECT CASE WHEN ($1<>0) THEN $2 ELSE $3 END;
>>'
>>LANGUAGE 'sql';
>>
>>--
>>Met vriendelijke groet,
>>
>>Marc Dirix
>>
>>_______________________________________________
>>Dbmail mailing list
>>Dbmail dbmail.org
>>htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
>
> _______________________________________________
> Dbmail mailing list
> Dbmail dbmail.org
> htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
>
--
____________________________________________________________
____
Paul Stevens paul at
nfg.nl
NET FACILITIES GROUP GPG/PGP:
1024D/11F8CD31
The Netherlands________________________________http://www.nfg.nl
_______________________________________________
Dbmail mailing list
Dbmail dbmail.org
htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
|
|
| SELECT IF(COUNT(*)>0,0,1) AS
no_children..... |

|
2006-02-03 04:08:34 |
Hi,
I tried the dbmail 2.0.8 but there is still the IF(
boolean, integer, integer ) function required, and my
postgresql installation does not include it by
default.. Is it normal ?
I fix mine by creating the function with
CREATE OR REPLACE FUNCTION "if"(boolean,
integer,
integer) RETURNS integer AS ' SELECT CASE WHEN $1 THEN
$2 ELSE $3 END; ' LANGUAGE 'sql';
But still think it stranges that the user require to
add this function.. Is my pgsql broken or dbmail
should not use this IF() function (or create it it the
create_tables.pgsql file) ?
Still I think dbmail is great and works fine for me
Etienne Adam
--- Paul J Stevens <paul nfg.nl> a écrit :
> I've fixed this. Please try again.
>
>
> Marc Dirix wrote:
> > Further looking at the code:
> >
> > in function:
> > db_get_result_bool
> >
> > return (tmp ? (atoi(tmp) ? 1 : 0) : 0); does
> actually do the same
> > as the IF statement in sql, so removing the
> function does look an
> > obvious way to go.
> >
> > Kind regards,
> >
> > Marc
> >
> >
> >
> > On Mon, Jan 23, 2006 at 01:21:04PM +0100, Marc
> Dirix wrote:
> >
> >>Hi,
> >>
> >>I'm using head svn from the unstable tree for
> dbmail.
> >>Backend PostgreSQL.
> >>Frontend IMAP.
> >>
> >>When I let my client lookup imap folders it
> returns this error:
> >>
> >>Jan 23 12:57:32 xi dbmail/imap4d[4438]:
> db.c,db_getmailbox_list_result:
> >>db error
> >>Jan 23 12:57:32 xi dbmail/imap4d[4438]:
dbpgsql.c,
> db_query: Error
> >>executing query [SELECT IF(COUNT(*)>0,0,1)
AS
> no_children FROM
> >>dbmail_mailboxes WHERE owner_idnr = '3' AND
name
> LIKE 'Verzonden
> >>items/%' ] : [ERROR: function if(boolean,
> integer, integer) does not
> >>exist HINT: No function matches the given name
> and argument types. You
> >>may need to add explicit type casts. ]
> >>
> >>
> >>The problem is, that postgresql doesn't have an
> "IF" function.
> >>
> >>Removing the complet IF statement, everything
> works OK.
> >>What is the purpose of the IF statement? And if
it
> is necessary it is
> >>possible to create such a function in pgsql:
> >>
> >>CREATE OR REPLACE FUNCTION
"if"(integer, integer,
> integer)
> >>RETURNS text AS
> >>'
> >> SELECT CASE WHEN ($1<>0) THEN $2 ELSE $3
END;
> >>'
> >>LANGUAGE 'sql';
> >>
> >>--
> >>Met vriendelijke groet,
> >>
> >>Marc Dirix
> >>
> >>_______________________________________________
> >>Dbmail mailing list
> >>Dbmail dbmail.org
> >>htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
> >
> > _______________________________________________
> > Dbmail mailing list
> > Dbmail dbmail.org
> > htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
> >
>
> --
>
>
____________________________________________________________
____
> Paul Stevens
> paul at nfg.nl
> NET FACILITIES GROUP GPG/PGP:
> 1024D/11F8CD31
> The
>
Netherlands________________________________http://www.nfg.nl
> _______________________________________________
> Dbmail mailing list
> Dbmail dbmail.org
> htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
>
____________________________________________________________
_______________
Nouveau : téléphonez moins cher avec Yahoo! Messenger !
Découvez les tarifs exceptionnels pour appeler la France et
l'international.
Téléchargez sur http://fr.messenger.yah
oo.com
_______________________________________________
Dbmail mailing list
Dbmail dbmail.org
htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
|
|
| SELECT IF(COUNT(*)>0,0,1) AS
no_children..... |

|
2006-02-03 15:06:13 |
Like you say, it shouldn't be required, and won't be
required for 2.0.9.
tam dadam wrote:
> Hi,
> I tried the dbmail 2.0.8 but there is still the IF(
> boolean, integer, integer ) function required, and my
> postgresql installation does not include it by
> default.. Is it normal ?
> I fix mine by creating the function with
> CREATE OR REPLACE FUNCTION "if"(boolean,
integer,
> integer) RETURNS integer AS ' SELECT CASE WHEN $1 THEN
> $2 ELSE $3 END; ' LANGUAGE 'sql';
>
> But still think it stranges that the user require to
> add this function.. Is my pgsql broken or dbmail
> should not use this IF() function (or create it it the
> create_tables.pgsql file) ?
>
> Still I think dbmail is great and works fine for me
> Etienne Adam
>
>
>
> --- Paul J Stevens <paul nfg.nl> a écrit :
>
>
>>I've fixed this. Please try again.
>>
>>
>>Marc Dirix wrote:
>>
>>>Further looking at the code:
>>>
>>>in function:
>>>db_get_result_bool
>>>
>>>return (tmp ? (atoi(tmp) ? 1 : 0) : 0); does
>>
>>actually do the same
>>
>>>as the IF statement in sql, so removing the
>>
>>function does look an
>>
>>>obvious way to go.
>>>
>>>Kind regards,
>>>
>>>Marc
>>>
>>>
>>>
>>>On Mon, Jan 23, 2006 at 01:21:04PM +0100, Marc
>>
>>Dirix wrote:
>>
>>>>Hi,
>>>>
>>>>I'm using head svn from the unstable tree
for
>>
>>dbmail.
>>
>>>>Backend PostgreSQL.
>>>>Frontend IMAP.
>>>>
>>>>When I let my client lookup imap folders it
>>
>>returns this error:
>>
>>>>Jan 23 12:57:32 xi dbmail/imap4d[4438]:
>>
>>db.c,db_getmailbox_list_result:
>>
>>>>db error
>>>>Jan 23 12:57:32 xi dbmail/imap4d[4438]:
dbpgsql.c,
>>
>>db_query: Error
>>
>>>>executing query [SELECT
IF(COUNT(*)>0,0,1) AS
>>
>>no_children FROM
>>
>>>>dbmail_mailboxes WHERE owner_idnr = '3' AND
name
>>
>>LIKE 'Verzonden
>>
>>>>items/%' ] : [ERROR: function if(boolean,
>>
>>integer, integer) does not
>>
>>>>exist HINT: No function matches the given
name
>>
>>and argument types. You
>>
>>>>may need to add explicit type casts. ]
>>>>
>>>>
>>>>The problem is, that postgresql doesn't have
an
>>
>>"IF" function.
>>
>>>>Removing the complet IF statement,
everything
>>
>>works OK.
>>
>>>>What is the purpose of the IF statement? And
if it
>>
>>is necessary it is
>>
>>>>possible to create such a function in pgsql:
>>>>
>>>>CREATE OR REPLACE FUNCTION
"if"(integer, integer,
>>
>>integer)
>>
>>>>RETURNS text AS
>>>>'
>>>>SELECT CASE WHEN ($1<>0) THEN $2 ELSE
$3 END;
>>>>'
>>>>LANGUAGE 'sql';
>>>>
>>>>--
>>>>Met vriendelijke groet,
>>>>
>>>>Marc Dirix
>>>>
>>>>____________________________________________
___
>>>>Dbmail mailing list
>>>>Dbmail dbmail.org
>>>>htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
>>>
>>>_______________________________________________
>>>Dbmail mailing list
>>>Dbmail dbmail.org
>>>htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
>>>
>>
>>--
>>
>>
>
>
____________________________________________________________
____
>
>> Paul Stevens
>>paul at nfg.nl
>> NET FACILITIES GROUP GPG/PGP:
>>1024D/11F8CD31
>> The
>>
>
> Netherlands________________________________http://www.nfg.nl
>
>>_______________________________________________
>>Dbmail mailing list
>>Dbmail dbmail.org
>>htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
>>
>
>
>
>
>
>
>
>
>
____________________________________________________________
_______________
> Nouveau : téléphonez moins cher avec Yahoo! Messenger !
Découvez les tarifs exceptionnels pour appeler la France et
l'international.
> Téléchargez sur http://fr.messenger.yah
oo.com
> _______________________________________________
> Dbmail mailing list
> Dbmail dbmail.org
> htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
>
--
____________________________________________________________
____
Paul Stevens paul at
nfg.nl
NET FACILITIES GROUP GPG/PGP:
1024D/11F8CD31
The Netherlands________________________________http://www.nfg.nl
_______________________________________________
Dbmail mailing list
Dbmail dbmail.org
htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
|
|
[1-5]
|
|