ERROR: index row size - Mailing list pgsql-hackers
From | Rodrigo Sakai |
---|---|
Subject | ERROR: index row size |
Date | |
Msg-id | 000f01c7a654$b8c0df60$6500a8c0@NOTEBOOKSAKAI Whole thread Raw |
Responses |
Re: ERROR: index row size
|
List | pgsql-hackers |
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> Hello,</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> Ok, I give up! Tried a lot of things in my code! But still get error on index row size. So, I’m partof my code, if someone could help me! A valid value for this type is: ‘(03-jan-2007 , 15-may-2010)’</span></font><p class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew"">typedef struct t_periodo</span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New"">{</span></font><pclass="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew""> DateADT tvi;</span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> DateADT tvf;</span></font><p class="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt;font-family:"Courier New"">} Periodo;</span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> </span></font><pclass="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew"">Datum</span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New"">periodo_in(PG_FUNCTION_ARGS)</span></font><pclass="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt;font-family:"Courier New"">{</span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> char *str = PG_GETARG_CSTRING(0);</span></font><p class="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt;font-family:"Courier New""> char tvi_char[MAXDATEFIELDS];</span></font><p class="MsoNormal"style="margin-left:.5in"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew""> char tvf_char[MAXDATEFIELDS];</span></font><p class="MsoNormal"style="margin-left:.5in"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew""> </span></font><p class="MsoNormal" style="margin-left:.5in"><font face="CourierNew" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> tvi_char = (char *) palloc(strlen(MAXDATEFIELDS));</span></font><pclass="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt;font-family:"Courier New""> tvf_char = (char *) palloc(strlen(MAXDATEFIELDS));</span></font><pclass="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt;font-family:"Courier New""> </span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> Periodo *result;</span></font><p class="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew""> </span></font><p class="MsoNormal" style="margin-left:.5in"><font face="CourierNew" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> if (sscanf(str, " ( %s , %s )", tvi_char,tvf_char) != 2)</span></font><p class="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt;font-family:"Courier New""> ereport(ERROR,</span></font><p class="MsoNormal"style="margin-left:.5in"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew""> (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),</span></font><pclass="MsoNormal" style="margin-left:.5in"><font face="CourierNew" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> errmsg("invalid input syntaxfor periodo: \"%s\"", str)));</span></font><p class="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt;font-family:"Courier New""> </span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> result->tvi= StringToDateADT(tvi_char); </span></font><p class="MsoNormal" style="margin-left:.5in"><font face="CourierNew" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> result->tvi = StringToDateADT(tvf_char);</span></font><pclass="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt;font-family:"Courier New""> </span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> result= (Periodo *) palloc(sizeof(Periodo));</span></font><p class="MsoNormal" style="margin-left:.5in"><font face="CourierNew" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> </span></font><p class="MsoNormal"style="margin-left:.5in"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew""> if (result->tvi > result->tvf)</span></font><p class="MsoNormal"style="margin-left:.5in"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew""> ereport(ERROR,</span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),</span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> errmsg("Initial date (TVi) must be smaller than final date (TVf)"))); </span></font><p class="MsoNormal"style="margin-left:.5in"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew""> </span></font><p class="MsoNormal" style="margin-left:.5in"><font face="CourierNew" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> PG_RETURN_POINTER(result);</span></font><pclass="MsoNormal" style="margin-left:.5in"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt;font-family:"Courier New"">}</span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> </span></font><pclass="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New""> </span></font><p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New""> Please help me!</span></font><p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New""> Thanks in advance!</span></font><p class="MsoNormal" style="margin-left:.5in"><font face="CourierNew" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> </span></font><p class="MsoNormal" style="margin-left:.5in"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New""> </span></font></div>
pgsql-hackers by date: