Unix Technical Forum

Re: plpgsql

This is a discussion on Re: plpgsql within the pgsql Novice forums, part of the PostgreSQL category; --> >>Am I missing anything or is >>record assignment not possible in plpgsql? > > > Your example works fine ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 09:30 PM
dim
 
Posts: n/a
Default Re: plpgsql


>>Am I missing anything or is
>>record assignment not possible in plpgsql?

>
>
> Your example works fine for me in PG 8.0. There were some improvements
> in this area since 7.*, though I'm not sure offhand whether they were
> material to this particular case.

strange.
laik is the table with rows nr integer and txt varchar.

CREATE OR REPLACE FUNCTION tst1(integer) RETURNS laik AS '
SELECT * FROM laik where nr=$1;
' LANGUAGE 'sql';

CREATE OR REPLACE FUNCTION tst2(integer) RETURNS varchar AS '
DECLARE
v laik;
BEGIN
v := tst1($1);
RETURN 1;
END;
' LANGUAGE 'plpgsql' VOLATILE;

if i try to 'select tst2(1);'
I get the following error message:
ERROR: syntax error at or near "v"
CONTEXT: compile of PL/pgSQL function "tst2" near line 4

I'm using Postgresql 7.4.3. Will try this with 8, but even if it works
with 8, it's not good - I don't know on what version of postgre my db
will later reside.

Thanks,
dim



---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:57 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com