Hee guys,

I addressed a problem with the check_number function on Postgres some
months ago on this mailing list. Postgres 7.3 does not understand the
'1::boolean'etc syntax. I created the function as shown after which
things worked for me:

CREATE FUNCTION cpb_check_number(integer)
        RETURNS boolean AS
                'SELECT CASE WHEN 
                (( SELECT COUNT(*)
                   FROM cpb_object
                   WHERE cpb_object.number = $1 ) > 0 )
                 THEN true
                 ELSE false
                END;'
LANGUAGE 'sql';

Regards,

Peter

-----Oorspronkelijk bericht-----
Van: Nico Klasens [mailto:[EMAIL PROTECTED] 
Verzonden: donderdag 13 november 2003 0:08
Aan: [EMAIL PROTECTED]
Onderwerp: RE: MMbase - PostgreSQL - Images problem


No, I don't think that it is a java 1.4 issue, bacause WIAB is running
on 1.4 too. 

2003-11-11 18:08:40,260 [ImageConvert] ERROR support.PostgreSQL71 - SQL
: INSERT INTO install_icaches (number, otype, owner, ckey, id, handle,
filesize) VALUES (?, ?, ?, ?, ?, ?, ?)
2003-11-11 18:08:40,261 [ImageConvert] ERROR support.PostgreSQL71 -
SQLState : null 
2003-11-11 18:08:40,261 [ImageConvert] ERROR support.PostgreSQL71 -
ErrorCode: 0
2003-11-11 18:08:40,261 [ImageConvert] ERROR support.PostgreSQL71 -
Message  : ERROR:  ExecAppend: rejected due to CHECK constraint
install_icaches_id_references

All before these log messages are just okay. The error says that it
fails on the check constraint of the number column. There is a function
in your database which looks like this.

CREATE FUNCTION install_check_number (integer) 
        RETURNS boolean AS 
                'SELECT CASE WHEN (( SELECT COUNT(*)
                FROM install_object
                WHERE install_object.number = $1 ) > 0 )
                THEN 1::boolean ELSE 0::boolean
                END;'
                LANGUAGE 'sql';

My suggestion is to set the log level for
org.mmbase.module.database.support to debug to see what the values are
for the preparedstatement. It ccould be that the new number is already
present (the autoicrement sequence is too low) or the function is
broken. It is probably the first one.

Nico

----------------------------------------------------------------------
Hardware: That part of the computer which you can kick 

> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Namens Peter van der Meer
> Verzonden: woensdag 12 november 2003 14:57
> Aan: '[EMAIL PROTECTED]'
> Onderwerp: RE: MMbase - PostgreSQL - Images problem
> 
> 
> Hello Nico,
> 
> I use PostgreSQL version 7.2 and my blob is saved in a bytea
> field. Could it be a java 1.4 problem?
> 
> Peter van der Meer
> 
> Software Developer
> VARA Nieuwe Media



Reply via email to