Thread: Modfying source code to read tuples before and after UPDATE...how to?

Modfying source code to read tuples before and after UPDATE...how to?

From
rmd22
Date:
Hello there,

I am a total novice to Postgresql, but very much interested in learning how
it works.

I have to modify the source code of Postgresql-9.0.1 such that whenever I
run an UPDATE command it should print out the old and new tuples. Since I am
a beginner I would appreciate it a lot if anyone of you out there could
point me in right direction. Which files will I need to modify to get the
desired results?
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Modfying-source-code-to-read-tuples-before-and-after-UPDATE-how-to-tp3251651p3251651.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: Modfying source code to read tuples before and after UPDATE...how to?

From
Raymond O'Donnell
Date:
On 05/11/2010 11:17, rmd22 wrote:
>
> Hello there,
>
> I am a total novice to Postgresql, but very much interested in learning how
> it works.
>
> I have to modify the source code of Postgresql-9.0.1 such that whenever I
> run an UPDATE command it should print out the old and new tuples. Since I am
> a beginner I would appreciate it a lot if anyone of you out there could
> point me in right direction. Which files will I need to modify to get the
> desired results?

When you say "print out", what do you mean exactly? Also, could you
achieve what you want with a trigger?

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

Well what i mean by print out is that it should print out the old and new
tuples on postgres terminal after the update is complete.
I tried it with triggers and I got what I wanted. But my professor for some
reason wants me to mess around with the source code :(
Do you think it's possible?



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Modfying-source-code-to-read-tuples-before-and-after-UPDATE-how-to-tp3251651p3252085.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: Re: Modfying source code to read tuples before and after UPDATE...how to?

From
Jacqui Caren-home
Date:
rmd22 wrote:
> Do you think it's possible?

replied offlist suggesting he have a chat with his prof and find the reason behind this task...

Re: Re: Modfying source code to read tuples before and after UPDATE...how to?

From
John R Pierce
Date:
On 11/05/10 9:23 AM, rmd22 wrote:
> Well what i mean by print out is that it should print out the old and new
> tuples on postgres terminal after the update is complete.
> I tried it with triggers and I got what I wanted. But my professor for some
> reason wants me to mess around with the source code :(
> Do you think it's possible?

what is the 'postgres terminal'  ?  its a service, running as a daemon,
it has no console normally, just a logfile.


should that only be printing tuples that are committed?   that becomes a
LOT harder.

a single UPDATE statement can modify a huge number of tuples.   also
ALTER TABLE statements can modify tuples, and of course INSERT
statements create new tuples.