Hello everyone,
I could use some help with this function I've created (see below) that runs flawlessly on PostgreSQL 8.3.6 on my development machine but ends with an error on the production server that has PostgreSQL 7.4.8 installed (see below).
My function:
PostgreSQL 7.4.8 error:
Category mentioned in the error is of the pseudo-type record and I can't see why PostgreSQL would think it's a column.
Any help would be appreciated as I can't find anything on this.
Thanks in advance :)
I could use some help with this function I've created (see below) that runs flawlessly on PostgreSQL 8.3.6 on my development machine but ends with an error on the production server that has PostgreSQL 7.4.8 installed (see below).
My function:
Code:
CREATE OR REPLACE FUNCTION generate_menu(varchar(255), char(2), varchar(255), int, varchar(255), int, int, varchar(255), varchar(255)) RETURNS text AS ' DECLARE -- declarations link_base ALIAS FOR $1; glue ALIAS FOR $2; extra_attributes ALIAS FOR $3; id_parent_target ALIAS FOR $4; link_categories ALIAS FOR $5; last_id ALIAS FOR $6; level ALIAS FOR $7; translate_from ALIAS FOR $8; translate_to ALIAS FOR $9; link_categories_new varchar(50) := ''''; category RECORD; subcategories text := ''''; output_string text := ''''; BEGIN -- function body SELECT id, id_parent, name INTO category FROM is_categories WHERE id>last_id AND status=''1'' AND id_parent=id_parent_target LIMIT 1; WHILE category IS NOT NULL LOOP link_categories_new := link_categories || glue || category.id; IF substring(link_categories_new from 1 for 2) = glue THEN link_categories_new := overlay((link_categories || glue || category.id) placing '''' FROM 1 FOR 2); END IF; output_string := output_string || ''<div><span class="level'' || level || ''"><a href="'' || link_base || link_categories_new || glue || translate(category.name, translate_from, translate_to) || ''" title="'' || category.name || ''" '' || extra_attributes || ''>'' || category.name || ''</a></span></div>''; SELECT * INTO subcategories FROM generate_menu(link_base, glue, extra_attributes, category.id, link_categories_new, category.id, (level + 1), translate_from, translate_to); output_string := output_string || subcategories; SELECT id, id_parent, name INTO category FROM is_categories WHERE id>category.id AND status=''1'' AND id_parent=id_parent_target LIMIT 1; END LOOP; RETURN output_string; END; ' LANGUAGE plpgsql;
Code:
ERROR: column "category" does not exist CONTEXT: PL/pgSQL function "generate_menu" line 19 at while In statement: select * from generate_menu('index.php?/eshop/category/', '__', '', 0, '', 0, 1, 'áäčďéěíľĺňóôŕřšťúůýžÁÄČĎÉĚÍĽĹŇÓÔŔŘŠŤÚŮÝŽ /', 'aacdeeillnoorrstuuyzAACDEEILLNOORRSTUUYZ_-');
Any help would be appreciated as I can't find anything on this.
Thanks in advance :)
Comment