473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 120946
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.