I waked up in the middle of the night with a dream.
I dreamed tha isn't the insert procedure that was raising this message, but the reading one.
So, I looked to the data stored in the database and there are 3 lines without values in the last 3 columns. I just delete then and the Image Gallery works perfectly, as usual in mojoportal.
So, it's solved, but there are missing parameters in the mp_galleryimages_insert function. Here is the code that I made to make it work:
CREATE OR REPLACE FUNCTION mp_galleryimages_insert(int4, int4, "varchar", text, text, "varchar", "varchar", "varchar", "timestamp", "varchar", "varchar", "varchar", "varchar")
RETURNS int4 AS
$BODY$
insert into mp_galleryimages
(
moduleid,
displayorder,
caption,
description,
metadataxml,
imagefile,
webimagefile,
thumbnailfile,
uploaddate,
uploaduser,
itemguid,
moduleguid,
userguid
)
values
(
$1,
$2,
$3,
$4,
$5,
$6,
$7,
$8,
$9,
$10,
$11,
$12,
$13
);
select cast(currval('mp_galleryimages_itemid_seq') as int4);; $BODY$
LANGUAGE 'sql' VOLATILE SECURITY DEFINER;
ALTER FUNCTION mp_galleryimages_insert(int4, int4, "varchar", text, text, "varchar", "varchar", "varchar", "timestamp", "varchar", "varchar", "varchar", "varchar") OWNER TO db2043a1;
GRANT EXECUTE ON FUNCTION mp_galleryimages_insert(int4, int4, "varchar", text, text, "varchar", "varchar", "varchar", "timestamp", "varchar", "varchar", "varchar", "varchar") TO public;
GRANT EXECUTE ON FUNCTION mp_galleryimages_insert(int4, int4, "varchar", text, text, "varchar", "varchar", "varchar", "timestamp", "varchar", "varchar", "varchar", "varchar") TO xxxyyyzzzkkk;