emedded SQL in C to get the record type from plpgsql - Mailing list pgsql-bugs

From Sun Duozhong(孙多忠)
Subject emedded SQL in C to get the record type from plpgsql
Date
Msg-id 000001ca9fd6$fc3b4180$f4b1c480$@com
Whole thread Raw
Responses Re: emedded SQL in C to get the record type from plpgsql
List pgsql-bugs
<div class="Section1"><p class="MsoPlainText"><span lang="EN-US" style="font-size:14.0pt">So how can emedded SQL in C
toget the record type which returning from plpgsql function?</span><p class="MsoPlainText"><span lang="EN-US"
style="font-size:14.0pt">Ihave tested as following code:</span><p class="MsoPlainText"><span lang="EN-US"> </span><p
class="MsoPlainText"><i><spanlang="EN-US">CREATE OR REPLACE FUNCTION test4(IN a integer, OUT b int,OUT c int) AS $BODY$
declarebegin b:=100; c:=200; return; END $BODY$</span></i><p class="MsoPlainText"><i><span lang="EN-US">  LANGUAGE
'plpgsql'VOLATILE</span></i><p class="MsoPlainText"><i><span lang="EN-US">  COST 100;</span></i><p
class="MsoPlainText"><i><spanlang="EN-US"> </span></i><p class="MsoPlainText"><i><span lang="EN-US"> </span></i><p
class="MsoPlainText"><i><spanlang="EN-US">// imbedded SQL in C</span></i><p class="MsoPlainText"><i><span
lang="EN-US">inttest(int a)</span></i><p class="MsoPlainText"><i><span lang="EN-US">{</span></i><p
class="MsoPlainText"><i><spanlang="EN-US"> </span></i><p class="MsoPlainText"><i><span lang="EN-US">EXEC SQL TYPE
my_typeIS STRUCT</span></i><p class="MsoPlainText"><i><span lang="EN-US">{</span></i><p class="MsoPlainText"><i><span
lang="EN-US">intb[1];</span></i><p class="MsoPlainText"><i><span lang="EN-US">int c[1];</span></i><p
class="MsoPlainText"><i><spanlang="EN-US">};</span></i><p class="MsoPlainText"><i><span lang="EN-US"> </span></i><p
class="MsoPlainText"><i><spanlang="EN-US">EXEC SQL BEGIN DECLARE SECTION;</span></i><p class="MsoPlainText"><i><span
lang="EN-US">my_typeppp;</span></i><p class="MsoPlainText"><i><span lang="EN-US">EXEC SQL END DECLARE
SECTION;</span></i><pclass="MsoPlainText"><i><span lang="EN-US"> </span></i><p class="MsoPlainText"><i><span
lang="EN-US">EXECSQL WHENEVER sqlerror SQLPRINT;</span></i><p class="MsoPlainText"><i><span lang="EN-US"> </span></i><p
class="MsoPlainText"><i><spanlang="EN-US">EXEC SQL select  test4(1) into :ppp;</span></i><p
class="MsoPlainText"><i><spanlang="EN-US">EXEC SQL COMMIT;</span></i><p class="MsoPlainText"><i><span
lang="EN-US">return0;</span></i><p class="MsoPlainText"><i><span lang="EN-US"> </span></i><p
class="MsoPlainText"><i><spanlang="EN-US">}</span></i><p class="MsoPlainText"><span lang="EN-US"> </span><p
class="MsoPlainText"><spanlang="EN-US" style="font-size:14.0pt">Running binary cause error:</span><p
class="MsoPlainText"><spanlang="EN-US" style="font-size:14.0pt">SQL error: invalid input syntax for type int:
"(100,200)",</span><pclass="MsoPlainText"><span lang="EN-US" style="font-size:14.0pt"> </span><p
class="MsoPlainText"><spanlang="EN-US" style="font-size:14.0pt">My project is migrating from Oracle to postgresql,can
youhelp me ?</span><p class="MsoNormal"><span lang="EN-US"> </span><p class="MsoNormal"><span lang="EN-US"> </span><p
class="MsoNormal"style="layout-grid-mode:char"><span lang="EN-US"
style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F3A87">Regards,</span><spanlang="EN-US"
style="font-size:10.0pt;font-family:"Verdana","sans-serif";
color:#1F3A87"></span><p class="MsoNormal" style="layout-grid-mode:char"><span lang="EN-US"
style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F3A87">George</span><b><spanlang="EN-US"
style="font-size:9.0pt;font-family:"ComicSans MS";color:teal"></span></b><p class="MsoNormal"
style="layout-grid-mode:char"><b><spanlang="EN-US" style="font-size:9.0pt;font-family:"Comic Sans
MS";color:teal">------------------------------------------------------------</span></b><spanlang="EN-US"></span><p
class="MsoNormal"><b><spanlang="EN-US" style="font-size:9.0pt;font-family:"他","serif"; 
color:teal">Duozhong Sun</span></b><b><span lang="EN-US" style="font-size:9.0pt;
font-family:"他","serif";color:teal"></span></b><p class="MsoNormal"><b><span lang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";
color:teal">Guangdong Revenco Enterprise Co</span></b><b><span lang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";color:teal">.</span></b><b><span lang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";color:teal">Ltd</span></b><b><spanlang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";color:teal">.</span></b><b><span lang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";color:teal">AMRIDepartment</span></b><b><span lang="EN-US"
style="font-size:9.0pt;font-family:
"他","serif";color:teal"></span></b><p class="MsoNormal"><b><span lang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";
color:teal">Tel</span></b><b><span style="font-size:9.0pt;font-family:"他","serif";
color:teal">:</span></b><span lang="EN-US" style="font-size:9.0pt;font-family:
"他","serif";color:teal">+86 20 8713</span><span lang="EN-US" style="font-size:
9.0pt;font-family:"Comic Sans MS";color:teal"> </span><span lang="EN-US" style="font-size:9.0pt;font-family:"Times New
Roman","serif";color:teal">5305</span><spanlang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";color:teal">,</span><spanlang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";color:teal">+8615800005957</span><span lang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";
color:teal"></span><p class="MsoNormal"><b><span lang="EN-US" style="font-size:9.0pt;font-family:"他","serif";
color:teal">Fax</span></b><b><span style="font-size:9.0pt;font-family:"他","serif";
color:teal">:</span></b><span lang="EN-US" style="font-size:9.0pt;font-family:
"他","serif";color:teal">+86 20 87135388</span><span lang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";color:teal"></span><pclass="MsoNormal"><b><span lang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";
color:teal">Address</span></b><b><span style="font-size:9.0pt;font-family:"他","serif";
color:teal">:</span></b><span lang="EN-US" style="font-size:9.0pt;font-family:
"他","serif""><span style="color:teal">368 Guangzhou Avenue South</span><span style="color:teal">,</span><span
style="color:teal">Guangzhou</span><spanstyle="color:teal"> 510300</span></span><span lang="EN-US"
style="font-size:9.0pt;
font-family:"他","serif";color:teal">,</span><span lang="EN-US" style="font-size:
9.0pt;font-family:"他","serif";color:teal">P.R.C.</span><span lang="EN-US"
style="font-size:9.0pt;font-family:"他","serif";color:teal"></span><pclass="MsoNormal"><b><span lang="EN-US"
style="font-size:9.0pt;font-family:"ComicSans MS"; 
color:teal">------------------------------------------------------------</span></b><span lang="EN-US"></span><p
class="MsoNormal"><spanlang="EN-US"> </span></div> 

pgsql-bugs by date:

Previous
From: Giorgio Valoti
Date:
Subject: Status of submitted bugs
Next
From: Mason Hale
Date:
Subject: Re: unable to fail over to warm standby server