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

  Hello,

 

  Ok, I give up! Tried a lot of things in my code! But still get error on index row size. So, I’m part of my code, if someone could help me! A valid value for this type is: ‘(03-jan-2007 , 15-may-2010)’

 

typedef struct t_periodo

{

      DateADT           tvi;

      DateADT           tvf;

}     Periodo;

 

Datum

periodo_in(PG_FUNCTION_ARGS)

{

    char    *str = PG_GETARG_CSTRING(0);

    char    tvi_char[MAXDATEFIELDS];

    char    tvf_char[MAXDATEFIELDS];

   

    tvi_char = (char *) palloc(strlen(MAXDATEFIELDS));

    tvf_char = (char *) palloc(strlen(MAXDATEFIELDS));

   

    Periodo     *result;

   

    if (sscanf(str, " ( %s , %s )", tvi_char, tvf_char) != 2)

        ereport(ERROR,

            (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),

            errmsg("invalid input syntax for periodo: \"%s\"", str)));

           

    result->tvi = StringToDateADT(tvi_char);           

    result->tvi = StringToDateADT(tvf_char);

   

    result = (Periodo *) palloc(sizeof(Periodo));

     

    if (result->tvi > result->tvf)

        ereport(ERROR,

                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),

                errmsg("Initial date (TVi) must be smaller than final date (TVf)")));     

   

    PG_RETURN_POINTER(result);

}

 

 

  Please help me!

  Thanks in advance!

 

 

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: What is happening on buildfarm member baiji?
Next
From: Jeremy Drake
Date:
Subject: Re: ERROR: index row size