Обсуждение: adding new field

Поиск
Список
Период
Сортировка

adding new field

От
"ranbeer makin"
Дата:
Hi,<br /><br />I have two questions to ask:<br /><br />1. How to flush buffer in postgres? I'm not able to see the
changesthat I make in my code. Sometimes the output comes and sometime it's not. What might be the problem?<br /><br />
2.I have added a new field in RESDOM structure, made necessary modifications in outfuncs.c, copy, read, equalfuncs.c
....butmy prog is behaving in a weird way, seems like some memory probs...What other modifications needs to be done to
reflectthe addition of this new field?<br /><br />I looked up into the archive, but not no results.<br /><br />Best,<br
/>Ranbeer<br />Hyderabad<br />India<br /> 

Re: adding new field

От
Martijn van Oosterhout
Дата:
On Mon, Jun 05, 2006 at 11:24:09PM +0530, ranbeer makin wrote:
> Hi,
>
> I have two questions to ask:
>
> 1. How to flush buffer in postgres? I'm not able to see the changes that I
> make in my code. Sometimes the output comes and sometime it's not. What
> might be the problem?

How do you mean? What kind of buffer? If you mean when does stuff in
the buffercache hit disk, well, normally they xlogged so they may not
appear in the actual datafiles. However, a CHECKPOINT may do it.

> 2. I have added a new field in RESDOM structure, made necessary
> modifications in outfuncs.c, copy, read, equalfuncs.c ....but my prog is
> behaving in a weird way, seems like some memory probs...What other
> modifications needs to be done to reflect the addition of this new field?

Did you remember to recompile *everything* affected? (--enable-depend
is useful for this). You also have to initdb again.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Re: adding new field

От
"Jonah H. Harris"
Дата:
On 6/5/06, ranbeer makin <ranbeer@gmail.com> wrote:
> 1. How to flush buffer in postgres? I'm not able to see the changes that I
> make in my code.

I assume you mean an output buffer?  If you're using fprintf, make
sure to do a fflush.  Otherwise, use elog(LOG or elog(DEBUG.

>  2. I have added a new field in RESDOM structure, made necessary
> modifications in outfuncs.c, copy, read, equalfuncs.c ....but my prog is
> behaving in a weird way, seems like some memory probs...What other
> modifications needs to be done to reflect the addition of this new field?

Example of *wierd*?

-- 
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation            | fax: 732.331.1301
33 Wood Ave S, 2nd Floor            | jharris@enterprisedb.com
Iselin, New Jersey 08830            | http://www.enterprisedb.com/


Re: adding new field

От
Tom Lane
Дата:
Martijn van Oosterhout <kleptog@svana.org> writes:
> On Mon, Jun 05, 2006 at 11:24:09PM +0530, ranbeer makin wrote:
>> 2. I have added a new field in RESDOM structure, made necessary
>> modifications in outfuncs.c, copy, read, equalfuncs.c ....but my prog is
>> behaving in a weird way, seems like some memory probs...What other
>> modifications needs to be done to reflect the addition of this new field?

> Did you remember to recompile *everything* affected? (--enable-depend
> is useful for this). You also have to initdb again.

Also, if you're working on a patch you hope to someday contribute, you
should be starting from CVS HEAD or some reasonable approximation of it.
Resdom disappeared more than a year ago:
http://archives.postgresql.org/pgsql-committers/2005-04/msg00060.php
        regards, tom lane


Re: adding new field

От
Alvaro Herrera
Дата:
Jonah H. Harris wrote:

> > 2. I have added a new field in RESDOM structure, made necessary
> >modifications in outfuncs.c, copy, read, equalfuncs.c ....but my prog is
> >behaving in a weird way, seems like some memory probs...What other
> >modifications needs to be done to reflect the addition of this new field?
> 
> Example of *wierd*?

http://www.m-w.com/

wierd:

The word you've entered isn't in the dictionary. Click on a spelling suggestion
below or try again using the search box to the right.

Suggestions for wierd:
 1. weird

weird:

Main Entry: 2weird
Function: adjective
1 : of, relating to, or caused by witchcraft or the supernatural : MAGICAL
2 : of strange or extraordinary character : ODD, FANTASTIC

(2weird, because 1weird is a noun)

Tom said some time ago "weird is spelled weirdly".

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


Re: adding new field

От
"Jonah H. Harris"
Дата:
On 6/5/06, Alvaro Herrera <alvherre@commandprompt.com> wrote:
> The word you've entered isn't in the dictionary.

Thanks Alvaro... my typing sometimes gets ahead of my in-brain spellcheck.

-- 
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation            | fax: 732.331.1301
33 Wood Ave S, 2nd Floor            | jharris@enterprisedb.com
Iselin, New Jersey 08830            | http://www.enterprisedb.com/


Re: adding new field

От
"ranbeer makin"
Дата:
hey,
let me clarify something.....

1. Whenever you run a query, its result or some other thing gets cached. I want to flush this cache? Also let me know when this cache gets flushed automatically.

2. After adding a new field in Resdom structure and making necessary changes in outfuncs.c, createfuncs. etc files, I *sometimes* get garbage value for the field added. The field is initialiazed to zero in makefuns.c....

3. **IMP*** Is there something in postgres that, only for N number of fields, of a structure, the memory is allocated, i.e., do I need to modify this "N" somewhere to reflect the addtion of a new field.

And that *weird* thing is:

1. I run some query, didn't get results.
2. Then, I commented the part which I modified [ i.e., commented that new field in Resdom structure], again run the same query, got results.
3. Next, I uncommented that part, and ran the same query again. I GOT THE RESULTS.

That's how my prog is behaving, behaving in a *weird* way. It seems like some memory probs somewhere. I can't figure it out. Yes, I'm re-compiling and running initdb whenever I make some modifications in the code.

I'm using release 8.03 and due to some reasons can't shift to some other release.

Regds,
Ranbeer



On 6/6/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Martijn van Oosterhout <kleptog@svana.org> writes:
> On Mon, Jun 05, 2006 at 11:24:09PM +0530, ranbeer makin wrote:
>> 2. I have added a new field in RESDOM structure, made necessary
>> modifications in outfuncs.c, copy, read, equalfuncs.c ....but my prog is
>> behaving in a weird way, seems like some memory probs...What other
>> modifications needs to be done to reflect the addition of this new field?

> Did you remember to recompile *everything* affected? (--enable-depend
> is useful for this). You also have to initdb again.

Also, if you're working on a patch you hope to someday contribute, you
should be starting from CVS HEAD or some reasonable approximation of it.
Resdom disappeared more than a year ago:
http://archives.postgresql.org/pgsql-committers/2005-04/msg00060.php

                        regards, tom lane

Re: adding new field

От
Martijn van Oosterhout
Дата:
On Tue, Jun 06, 2006 at 09:44:04PM +0530, ranbeer makin wrote:
> hey,
> let me clarify something.....
>
> 1. Whenever you run a query, its result or some other thing gets cached. I
> want to flush this cache? Also let me know when this cache gets flushed
> automatically.

What cache? Query results are not cached, neither are plans. Please be
specific.

> 2. After adding a new field in Resdom structure and making necessary changes
> in outfuncs.c, createfuncs. etc files, I *sometimes* get garbage value for
> the field added. The field is initialiazed to zero in makefuns.c....

Check for other places in the code that create that structure. makefunc
is more convienience than anything else.

> 3. **IMP*** Is there something in postgres that, only for N number of
> fields, of a structure, the memory is allocated, i.e., do I need to modify
> this "N" somewhere to reflect the addtion of a new field.

Postgres uses sizeof() always, so as long as all the files are compiled
the same way, everything will work.

> And that *weird* thing is:
>
> 1. I run some query, didn't get results.
> 2. Then, I commented the part which I modified [ i.e., commented that new
> field in Resdom structure], again run the same query, got results.
> 3. Next, I uncommented that part, and ran the same query again. I GOT THE
> RESULTS.

Did you rerun make install and restart the postmaster between each run?

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.