473,461 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Pseudo-type record seen as column by an older PostgreSQL version

8
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:
Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE FUNCTION generate_menu(varchar(255), char(2), varchar(255), int, varchar(255), int, int, varchar(255), varchar(255)) RETURNS text AS '
  2. DECLARE
  3.     -- declarations
  4.     link_base        ALIAS FOR $1;
  5.     glue            ALIAS FOR $2;
  6.     extra_attributes    ALIAS FOR $3;
  7.     id_parent_target    ALIAS FOR $4;
  8.     link_categories        ALIAS FOR $5;
  9.     last_id            ALIAS FOR $6;
  10.     level            ALIAS FOR $7;
  11.     translate_from        ALIAS FOR $8;
  12.     translate_to        ALIAS FOR $9;
  13.     link_categories_new    varchar(50) := '''';
  14.     category        RECORD;
  15.     subcategories        text := '''';
  16.     output_string        text := '''';
  17. BEGIN
  18.     -- function body
  19.     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;
  20.     WHILE category IS NOT NULL LOOP
  21.         link_categories_new := link_categories || glue || category.id;
  22.         IF substring(link_categories_new from 1 for 2) = glue THEN
  23.             link_categories_new := overlay((link_categories || glue || category.id) placing '''' FROM 1 FOR 2);
  24.         END IF;
  25.  
  26.         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>'';
  27.         SELECT * INTO subcategories FROM generate_menu(link_base, glue, extra_attributes, category.id, link_categories_new, category.id, (level + 1), translate_from, translate_to);
  28.         output_string := output_string || subcategories;
  29.         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;
  30.     END LOOP;
  31.  
  32.     RETURN output_string;
  33. END;
  34. ' LANGUAGE plpgsql;
PostgreSQL 7.4.8 error:
Expand|Select|Wrap|Line Numbers
  1. ERROR:  column "category" does not exist
  2. CONTEXT:  PL/pgSQL function "generate_menu" line 19 at while
  3.  
  4. In statement:
  5. select * from generate_menu('index.php?/eshop/category/', '__', '', 0, '', 0, 1, 'áäčďéěíľĺňóôŕřšťúůýžÁÄČĎÉĚÍĽĹŇÓÔŔŘŠŤÚŮÝŽ /', 'aacdeeillnoorrstuuyzAACDEEILLNOORRSTUUYZ_-');
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 :)
Apr 11 '09 #1
1 120950
Slapo
8
I'll reply to myself here:
changing:
Expand|Select|Wrap|Line Numbers
  1. WHILE category IS NOT NULL LOOP
to:
Expand|Select|Wrap|Line Numbers
  1. WHILE category.id IS NOT NULL LOOP
solved the problem.
Apr 11 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Andrew Thompson | last post by:
I would like to create a menu that uses the 'active' pseudo-class to highlight the current page, but I cannot get it to work. The URL http://www.lensescapes.com/tst/nav/1.jsp shows the attempts...
4
by: Stephen Poley | last post by:
The issue of the focus pseudo-class came up a few weeks ago, and I finally got around to trying it out (better late than never ...) The recommended order given for the pseudo-classes is link,...
8
by: Kerberos | last post by:
As you might know, IE doesn't support the :hover pseudo-class on every tag (just the "a" tag AFAIK) Is there a simple JavaScript that would solve the problem? I have images that have a light blue...
6
by: Fungii | last post by:
Hello, I have a stylesheet that sets p:first-letter to a certain size and colour. I was playing around with Javascript to change paragraph stylesheets using an array like this: var paras =...
70
by: Ben Pfaff | last post by:
One issue that comes up fairly often around here is the poor quality of the pseudo-random number generators supplied with many C implementations. As a result, we have to recommend things like...
37
by: pochartrand | last post by:
Hello, Is there a way to manipulate or at least read the pseudo-class of an element ? I know the style attribute can be accessed and gives the CSS properties for a particular element....
3
by: yawnmoth | last post by:
I've seen a few webpages that use the javascript pseudo-protocol with event handlers. eg. <input onkeyup="javascript: ..." /> Correct me if I'm wrong, but isn't onkeyup always supposed to be...
0
by: Kevin Frey | last post by:
WebControl contains properties such as ControlStyle and Style for controlling the style of a web-control. In particular the Style property is a CssStyleCollection that simply comprises key-value...
3
by: shakthi | last post by:
Hi all. Am a beginner in device driver programming. Please tell me how to get handle for a pseudo driver..., a driver with no device connected i suppose.Am using CreateFile() win32 API. Since it is...
3
by: bytehunter | last post by:
Hello, I hope this is the best place to ask my question. I was wondering if there was such a thing as a pseudo terminal in Windows. For those unfamiliar, in Linux/Unix one can create a pseudo...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.