Skip site navigation (1) Skip section navigation (2)

Re: ERROR: index row size

From: "Rodrigo Sakai" <rodrigo(dot)sakai(at)poli(dot)usp(dot)br>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ERROR: index row size
Date: 2007-06-04 03:59:18
Message-ID: 001701c7a65c$b9fd3650$6500a8c0@NOTEBOOKSAKAI (view raw or flat)
Thread:
Lists: pgsql-hackers
  Hello Jeremy,

  You are right about: 
   char tvi_char[MAXDATEFIELDS];

  I have already tried this and didn't work too, it keeps giving the index
error!


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

  I test tvi_char and tvf_char with StringToDateADT(tvi_char). Just date
types are allowed!

  Any other suggestions??
  Thanks!

-----Original Message-----
From: Jeremy Drake [mailto:pgsql(at)jdrake(dot)com] 
Sent: segunda-feira, 4 de junho de 2007 00:23
To: Rodrigo Sakai
Cc: PostgreSQL Hackers
Subject: Re: [HACKERS] ERROR: index row size

Just glancing at this, a couple things stand out to me:

On Mon, 4 Jun 2007, Rodrigo Sakai wrote:

> 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));

What are you doing here?  This is completely broken.  I think you meant to
say:

char *tvi_char;

tvi_char = palloc(MAXDATEFIELDS);

Or:

char tvi_char[MAXDATEFIELDS];

and no palloc.

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

Same as above.

>
>     Periodo     *result;
>
>     if (sscanf(str, " ( %s , %s )", tvi_char, tvf_char) != 2)

This is asking for trouble if arbitrary input can be fed to this.

>         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!

Hope this helps.

-- 
My love, he's mad, and my love, he's fleet,
	And a wild young wood-thing bore him!
The ways are fair to his roaming feet,
	And the skies are sunlit for him.
As sharply sweet to my heart he seems
	As the fragrance of acacia.
My own dear love, he is all my dreams --
	And I wish he were in Asia.
		-- Dorothy Parker


In response to

pgsql-hackers by date

Next:From: Rodrigo SakaiDate: 2007-06-04 04:34:34
Subject: Re: ERROR: index row size
Previous:From: Tom LaneDate: 2007-06-04 03:53:19
Subject: Re: ERROR: index row size

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group