Skip site navigation (1) Skip section navigation (2)

Function working in PostgreSQL 8.3.6 and not in 7.4.8

From: <slapo(at)centrum(dot)sk>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Function working in PostgreSQL 8.3.6 and not in 7.4.8
Date: 2009-04-11 20:41:41
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

I've created this function:
CREATE OR REPLACE FUNCTION subcategories(int) RETURNS setof int AS '
    -- declarations
    category        ALIAS FOR $1;
    category_current    record;
    -- function body
    RETURN QUERY SELECT category as my_output;
    FOR category_current IN SELECT id FROM is_categories WHERE id_parent=category AND status=''1'' LOOP
        RETURN QUERY SELECT as my_output UNION SELECT * FROM subcategories(;
' LANGUAGE plpgsql;

It works well on my development machine with PostgreSQL 8.3.6 (return subcategories, as its name suggests).

This query on a server where there's 7.4.8 installed:
SELECT id FROM is_categories WHERE id_parent=1 AND status='1';
does return two rows (as it should), but:
SELECT * FROM subcategories(1);
returns none and there's no error message either.

It's my second function in pg/plsql I've created and I don't really know why there are no results being returned in 7.4.8.

Any ideas are appreciated.

Thanks in advance. :)


Peter Slapansky


pgsql-novice by date

Next:From: Tom LaneDate: 2009-04-11 20:57:22
Subject: Re: Function working in PostgreSQL 8.3.6 and not in 7.4.8
Previous:From: Rupinder.SinghDate: 2009-04-09 17:10:56
Subject: Re: Time-based trigger/procedure

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group