Desde hace ya bastante tiempo, cosa de 1 año, venÃa teniendo problemas con gallery2. Por un lado, algunas imágenes de álbumes no se veÃan, aparecÃa el mensaje “Render error” [1]. Otro de los problemas, era que ni en las páginas de los álbumes ni en las de las fotos aparecÃan los comentarios. Ni tampoco el plugin para mostrar datos exif.
Parece un problema común, y hay bastante gente con este problema [2], incluÃdo bug en Debian [3]
Si configuras el gallery2 en modo debug (en el config.php), buceando un poco entre toda la morralla, se podÃa extraer este error:
postgres7 error: [-1: ERROR: column "g_userid" is of type integer but expression is of type text HINT: You will need to rewrite or cast the expression.] in EXECUTE(” INSERT INTO g_ImageBlockCacheMap SELECT DISTINCT ?, ?, g_Entity.g_creationTimestamp, g_Entity.g_id, FLOOR(RANDOM() * 2147483647) FROM g_Entity, g_DataItem, g_AccessSubscriberMap, g_ChildEntity, g_Derivative WHERE g_DataItem.g_id = g_Entity.g_id AND g_AccessSubscriberMap.g_itemId = g_Entity.g_id AND g_AccessSubscriberMap.g_accessListId IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) AND g_ChildEntity.g_parentId = g_Entity.g_id AND g_Derivative.g_id = g_ChildEntity.g_id AND g_Derivative.g_derivativeType = ? “)
(postgres7): INSERT INTO g_ImageBlockCacheMap SELECT DISTINCT ?, ?, g_Entity.g_creationTimestamp, g_Entity.g_id, FLOOR(RANDOM() * 2147483647) FROM g_Entity, g_DataItem, g_AccessSubscriberMap, g_ChildEntity, g_Derivative WHERE g_DataItem.g_id = g_Entity.g_id AND g_AccessSubscriberMap.g_itemId = g_Entity.g_id AND g_AccessSubscriberMap.g_accessListId IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) AND g_ChildEntity.g_parentId = g_Entity.g_id AND g_Derivative.g_id = g_ChildEntity.g_id AND g_Derivative.g_derivativeType = ? [ (0=>'7903') (1=>'1') (2=>'11072') (3=>'11073') (4=>'11074') (5=>'11075') (6=>'11076') (7=>'11077') (8=>'11078') (9=>'11079') (10=>'11080') (11=>'11081') (12=>'11082') (13=>'11083') (14=>'11084') (15=>'11085') (16=>'11086') (17=>'11087') (18=>'11088') (19=>'11089') (20=>'11090') (21=>'11097') (22=>'1') ]
Warning: pg_query_params() [function.pg-query-params]: Query failed: ERROR: column “g_userid” is of type integer but expression is of type text HINT: You will need to rewrite or cast the expression. in /usr/share/php/adodb/drivers/adodb-postgres7.inc.php on line 162
-1: ERROR: column “g_userid” is of type integer but expression is of type text HINT: You will need to rewrite or cast the expression.
ADOConnection._Execute( INSERT INTO
g_ImageBlockCacheMap SELECT DISTINCT ?, ?,
g_Entity.g_creationTimestamp, g_Entity.gaina…,
Array[23]) % line 1013, file: adodb.inc.php
ADOConnection.Execute(
INSERT INTO g_ImageBlockCacheMap SELECT DISTINCT ?, ?,
g_Entity.g_creationTimestamp, g_Entity.gaina…,
Array[23]) % line 952, file: GalleryStorageExtras.class
GalleryStorageExtras.execute(
INSERT INTO [ImageBlockCacheMap] SELECT DISTINCT ?, ?,
[GalleryEntity::creationTimestamp], [GalleryEntity::id], FLOOR(R…,
Array[23]) % line 507, file: GalleryStorage.class
GalleryStorage.execute( INSERT INTO
[ImageBlockCacheMap] SELECT DISTINCT ?, ?,
[GalleryEntity::creationTimestamp], [GalleryEntity::id], FLOOR(R…,
Array[23]) % line 742, file: ImageBlockHelper.class
ImageBlockHelper.cacheViewableTree(7903) % line 520, file: ImageBlockHelper.class
Error performing imageblock.LoadImageBlock callback realpath(/usr/share/gallery2/modules/core/classes/../../../) realpath(/var/) Error (ERROR_STORAGE_FAILURE)
* in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 959 (GalleryCoreApi::error)
* in modules/core/classes/GalleryStorage.class at line 507 (GalleryStorageExtras::execute)
* in modules/imageblock/classes/ImageBlockHelper.class at line 742 (GalleryStorage::execute)
* in modules/imageblock/classes/ImageBlockHelper.class at line 520 (ImageBlockHelper::cacheViewableTree)
* in modules/imageblock/classes/ImageBlockHelper.class at line 283 (ImageBlockHelper::fetchViewableData)
* in modules/imageblock/classes/ImageBlockHelper.class at line 93 (ImageBlockHelper::_getBlockData)
* in modules/imageblock/Callbacks.inc at line 83 (ImageBlockHelper::loadImageBlocks)
* in modules/core/classes/GalleryTemplateAdapter.class at line 1052 (ImageBlockCallbacks::callback)
* in /var/gallery2/smarty/templates_c/%%626616196/floatrix/%%A3^A3E^A3E218EA%%ImageBlock.tpl.php at line 5 (GalleryTemplateAdapter::callback)
* in /usr/share/php/smarty/libs/Smarty.class.php at line 1868
* in modules/core/classes/GalleryTemplateAdapter.class at line 983 (Smarty::_smarty_include)
* in /var/gallery2/smarty/templates_c/%%626616196/floatrix/%%BB^BB6^BB6583D1%%sidebar.tpl.php at line 13 (GalleryTemplateAdapter::block)
* in /usr/share/php/smarty/libs/Smarty.class.php at line 1868
* in modules/core/classes/GalleryTemplateAdapter.class at line 909 (Smarty::_smarty_include)
* in /var/gallery2/smarty/templates_c/%%626616196/floatrix/%%6A^6A5^6A56B843%%theme.tpl.php at line 69 (GalleryTemplateAdapter::theme)
* in /usr/share/php/smarty/libs/Smarty.class.php at line 1262
* in modules/core/classes/GallerySmarty.class at line 61 (Smarty::fetch)
* in modules/core/classes/GalleryTemplate.class at line 219 (GallerySmarty::fetch)
* in main.php at line 521 (GalleryTemplate::fetch)
* in main.php at line 104
* in main.php at line 88
* in main.php at line 3
La solución temporal para este caso, es convertir las columnas que son de tipo integer a tipo text:
gallery2=# ALTER TABLE g_ImageBlockCacheMap ALTER COLUMN g_userId TYPE text;
ALTER TABLE
gallery2=# ALTER TABLE g_ImageBlockCacheMap ALTER COLUMN g_itemType TYPE text;
ALTER TABLE
Parece algo tan simple, ¿verdad? Se queja de ser tipo integer cuando espera un tipo text. Pues se convierte y punto. Pero bueno, hay veces que siempre buscas una solución más limpia.
Supongo que en alguna actualización convertirÃan el campo a tipo texto, e igual a mi y a otrxs nos falló. He estado buscando en el histórico de las sources pero no he visto que haya sido tipo texto nunca. O quizás antes hacÃan un cast de text a integer en la case.. ni idea.
Actualización Oct 8, 2009: Parece que es lo que se hizo en una de las revisiones:
http://gallery.svn.sourceforge.net/viewvc/gallery/branches/BRANCH_2_1/gallery2/modules/imageblock/classes/ImageBlockHelper.class?r1=12540&r2=12689&pathrev=20937
También he visto, que en uno de los logs de actualización del gallery2 (Debian/Testing) versión 2.2.1 con fecha 2007-09-23 13:57:04, se actualizó la tabla ImageBlockCacheMap:
2007-09-23 13:57:07 [TMP_SESSION_ID_DI_NOISSES_PMT]
(postgres7): UPDATE g_Schema SET gg_createSql = ‘CREATE TABLE DB_TABLE_PREFIXImageBlockCacheMap(
DB_COLUMN_PREFIXuserId INTEGER NOT NULL,
DB_COLUMN_PREFIXitemType INTEGER NOT NULL,
DB_COLUMN_PREFIXitemTimestamp INTEGER NOT NULL,
DB_COLUMN_PREFIXitemId INTEGER NOT NULL
);
En cualquier caso, por fin está arreglado
Referencias:
[1] http://gallery.menalto.com/node/85450
[2] http://gallery.menalto.com/node/83164
[3] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518572
convert this post to pdf.