pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problems with function while migrating from Windows to Linux
2+ messages / 2 participants
[nested] [flat]

* Problems with function while migrating from Windows to Linux
@ 2008-04-22 09:47 Jan Peters <petersjan@gmx.at>
  2008-04-22 12:30 ` Re: Problems with function while migrating from Windows to Linux Craig Ringer <craig@postnewspapers.com.au>
  0 siblings, 1 reply; 2+ messages in thread

From: Jan Peters @ 2008-04-22 09:47 UTC (permalink / raw)
  To: pgsql-sql

Hello list,
after developping my application in a Windows environment I am now migrating to the production Linux webserver. I backed up my database, functions and schemas and imported them again via pgAdmin III, because the first application which I used to do the transfer did not move the variable aliases within the function. So what I have (what is running under Windows) is:

function: 

getgv_neu(id int4, tablename text, runde1 int4, runde2 int4) returns int4:

--------------------8<----------------------------

DECLARE
tablename1 varchar := quote_ident(tablename);
result_aktiva integer;
result_passiva integer;
sum integer;
BEGIN
EXECUTE 'SELECT getaktiva(' || id|| ',' || runde1 || ',' || runde2 || ') ;' INTO result_aktiva;
if result_aktiva < -100000 THEN
RETURN result_aktiva;
END IF;
EXECUTE 'SELECT getpassiva(\'' || tablename1 || '\',' || id || ');' INTO result_passiva;
sum = result_aktiva - result_passiva;
RETURN sum;
END;


--------------------8<----------------------------

when I do e.g. a "select getgv_neu(5,'company_5',1,0)" I get the error message:

ERROR:  syntax error at or near "$4" at character 81
QUERY:  SELECT  'SELECT getaktiva(' ||  $1 || ',' ||  $2  || ',' ||  $3  || ') ;' INTO  $4
CONTEXT:  PL/pgSQL function "getgv_neu" line 7 at execute statement

What might be the problem here? Any ideas? I am stuck...

Thanks again in advance

Jan Peters-Anders



-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Problems with function while migrating from Windows to Linux
  2008-04-22 09:47 Problems with function while migrating from Windows to Linux Jan Peters <petersjan@gmx.at>
@ 2008-04-22 12:30 ` Craig Ringer <craig@postnewspapers.com.au>
  0 siblings, 0 replies; 2+ messages in thread

From: Craig Ringer @ 2008-04-22 12:30 UTC (permalink / raw)
  To: Jan Peters <petersjan@gmx.at>; +Cc: pgsql-sql

Jan Peters wrote:
> Hello list,
> after developping my application in a Windows environment I am now migrating to the production Linux webserver.
>   
[snip]
> when I do e.g. a "select getgv_neu(5,'company_5',1,0)" I get the error message:
>
> ERROR:  syntax error at or near "$4" at character 81
> QUERY:  SELECT  'SELECT getaktiva(' ||  $1 || ',' ||  $2  || ',' ||  $3  || ') ;' INTO  $4
> CONTEXT:  PL/pgSQL function "getgv_neu" line 7 at execute statement
>
> What might be the problem here? Any ideas? I am stuck...
>   
At a guesss, you were using PostgreSQL 8.3 under Windows and the 
production Linux system has PostgreSQL 8.2 or earlier, which does not 
support EXECUTE ... INTO .

--
Craig Ringer




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2008-04-22 12:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-04-22 09:47 Problems with function while migrating from Windows to Linux Jan Peters <petersjan@gmx.at>
2008-04-22 12:30 ` Craig Ringer <craig@postnewspapers.com.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox