Carefully check all the palloc's you are doing in your code.
This warning is shown when you write some extra bytes to the memory
and size of your data goes beyond the allocated size.

--Imad
EnterpriseDB (www.enterprisedb.com)


On 11/1/06, luis garcia <[EMAIL PROTECTED]> wrote:

Hi We have been making some modifications to postgres catalog, but
it seems to be a problem with one of the fields we just added, exactly
in the time when inserting the right values to that specific field.

1. This is what It happens:

**************************************
template1=# CREATE TABLE test() AS VALID EVENT 2 WITH FREQUENCY
'00:00:50.00' AS REAL TIME;
WARNING:  detected write past chunk end in CacheMemoryContext 0xb7212e0c
CREATE TABLE
**************************************

The creation it's possible, in fact, We have added 7 fields to Postgres
catalog (in pg_class) and there are no problems with the other fields
values,
 just with this one.


2. The field is defined this way:
 // FILE: Parsenodes.h
 // STRUCTURE: frequencyDefinition

 typedef struct FrequencyDefinition
 {
     NodeTag        type;
     bool        timeFrequency;
     FrequencyType    fttype;
     const char    *frequencyMeasure; // THIS ONE
 } FrequencyDefinition;


3. The values are inserted this way:
// FILE: relcache.c
// FUNCTION: RelationBuildLocalRelation

**************************************
rel->rd_rel->relhasfrequency = freqDef->timeFrequency;  // Perfect
Asignation

if((freqDef->fttype) == REAL_TIME)

namestrcpy(&rel->rd_rel->relfrequencytype,(const char
*)"REAL TIME");
        else

namestrcpy(&rel->rd_rel->relfrequencytype,(const char
*)"HISTORIC");

namestrcpy(&rel->rd_rel->relfrequency,freqDef->frequencyMeasure)
**************************************


We can see the other values whit a SELECT over PG_CLASS:

template1=# SELECT relname, relhasfrequency, relfrequencytype, relfrequency
FROM pg_class WHERE relhasfrequency=true;

 relname  | relhasfrequency | relfrequencytype | relfrequency
 - - - - - -  + - - - - - - - - - - - - + - - - - - - - - - - - - - + - - -
- - - - - -
 test         | t                        | REAL TIME          | 0
(1 row)

We have realized that in the assignation it takes just the first CHAR from
'00:00:50.00',
and we tested the same assignation but just like this:

***************************************
namestrcpy(&rel->rd_rel->relfrequencytype,freqDef->frequencyMeasure);
//namestrcpy(&rel->rd_rel->relfrequency,freqDef->frequencyMeasure)
***************************************

And the result to the same query was:

template1=# SELECT relname, relhasfrequency, relfrequencytype, relfrequency
FROM pg_class WHERE relhasfrequency=true;

  relname  | relhasfrequency | relfrequencytype | relfrequency
  - - - - - -  + - - - - - - - - - - - - + - - - - - - - - - - - - - + - - -
- - - - - -
  test         | t                        | '00:00:50.00'         | 0
 (1 row)


So please, anybody could tell me how to fix this?

Thanks...
--
Luis D. García M.
Telf: 0414-3482018

- FACYT - UC -
- Computación -

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to