improper call to spi_printtup ???

From: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>
To: pgsql-hackers(at)postgresql(dot)org
Subject: improper call to spi_printtup ???
Date: 2004-06-28 17:54:21
Message-ID: 200406281954.21275.darko.prenosil@finteh.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have set returning function written in 'c', declared as:

CREATE OR REPLACE FUNCTION check_view (text,text) RETURNS setof pg_attribute
AS '/usr/local/pgsql/lib/libplpq.so','check_view' LANGUAGE 'c'
WITH (isstrict);

When I call this function from psql :
SELECT attrelid,attnum FROM check_view('pg_catalog','pg_tables') ;
I have:
attrelid | attnum
----------+--------
16595 | 1
1259 | 1
0 | 0
1259 | 11
1259 | 22
0 | 0
That is expected result, or in other words it works fine.

Now when I try to use 'check_view0 function in some other pl/psql function:

CREATE OR REPLACE FUNCTION testfunc() RETURNS bool AS '
BEGIN
SELECT attrelid,attnum FROM check_view(''pg_catalog'',''pg_tables'') ;
RETURN FALSE;
END;' LANGUAGE 'plpgsql';

SELECT testfunc() ;

I have:
(-403)ERROR: improper call to spi_printtup
CONTEXT: PL/pgSQL function "testfunc" line 2 at SQL statement

Anyone knows what I'm doing wrong ? Is there some special issue when writing
functions for pl/psql that I'm not aware ?

Thanks in advance !

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Rylander 2004-06-28 18:40:10 Quick question regarding tablespaces
Previous Message Gavin Sherry 2004-06-28 17:04:12 Re: Tablespace permissions issue