Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/10/2011, 06:44
Avatar de djmashe
djmashe
 
Fecha de Ingreso: julio-2007
Ubicación: Posadas, Misiones
Mensajes: 52
Antigüedad: 16 años, 10 meses
Puntos: 2
Exclamación array_length en postgres 8.3

Saludos, el tema es el siguiente: bajo postgres 8.3 no se soporta la funcion array_length, cuando quiero ejecutar una consulta como:

Código SQL:
Ver original
  1. -- Function: texto_array((text[])
  2. DROP FUNCTION IF EXISTS texto_array(text[]);
  3. CREATE OR REPLACE FUNCTION texto_array(text[])
  4.   RETURNS text AS
  5. $BODY$
  6. DECLARE
  7. BEGIN
  8.   FOR i IN 1..(array_length(array[1,2,3], 1)) LOOP
  9.     raise notice '%', i;
  10.   END LOOP;
  11.   RETURN TRUE;
  12. END;
  13. $BODY$
  14. LANGUAGE 'plpgsql';
  15. ALTER FUNCTION texto_array(text[]) OWNER TO postgres;

Da el siguiente error:

ERROR: function array_length(integer[], integer) does not exist
LINE 1: SELECT (array_length(array[1,2,3], 1))


¿Que alternativa existe para poder contar la cantidad de elementos de un array?
¿Y como se contaria en el caso de arrays bidimensionales o tridimensionales?

Desde ya gracias.