Re: [GENERAL] Is this possible in a trigger?

2008-05-07 Thread Kerri Reno
Fernando, Below is a function that I hope gets you started. It hasn't been tested, I cut and pasted from our procedure, which is rather more complex. You didn't say what you wanted to do with the changes when you found them, this puts them in a log_audit table. The thing to remember about pytho

Re: [GENERAL] Is this possible in a trigger?

2008-05-07 Thread Fernando
Thank you for your answer. I guess I better create this history in the application's data class. Klint Gore wrote: Fernando wrote: I want to keep a history of changes on a field in a table. This will be the case in multiple tables. Can I create a trigger that loops the OLD and NEW values a

Re: [GENERAL] Is this possible in a trigger?

2008-05-07 Thread valgog
On May 6, 11:05 pm, [EMAIL PROTECTED] (Fernando) wrote: > I want to keep a history of changes on a field in a table.  This will be > the case in multiple tables. > > Can I create a trigger that loops the OLD and NEW values and compares > the values and if they are different creates a change string

Re: [GENERAL] Is this possible in a trigger?

2008-05-07 Thread hubert depesz lubaczewski
On Tue, May 06, 2008 at 05:05:37PM -0400, Fernando wrote: > I want to keep a history of changes on a field in a table. This will be > the case in multiple tables. http://pgfoundry.org/projects/tablelog/ depesz -- quicksil1er: "postgres is excellent, but like any DB it requires a highly paid D

Re: [GENERAL] Is this possible in a trigger?

2008-05-06 Thread Robert Treat
On Tuesday 06 May 2008 20:10:50 Klint Gore wrote: > Fernando wrote: > > I want to keep a history of changes on a field in a table. This will > > be the case in multiple tables. > > > > Can I create a trigger that loops the OLD and NEW values and compares > > the values and if they are different cr

Re: [GENERAL] Is this possible in a trigger?

2008-05-06 Thread Kerri Reno
This is easy with plpython. We do something similar. Kerri On Tue, May 6, 2008 at 6:10 PM, Klint Gore <[EMAIL PROTECTED]> wrote: > Fernando wrote: > > > I want to keep a history of changes on a field in a table. This will be > > the case in multiple tables. > > > > Can I create a trigger that

Re: [GENERAL] Is this possible in a trigger?

2008-05-06 Thread Klint Gore
Fernando wrote: I want to keep a history of changes on a field in a table. This will be the case in multiple tables. Can I create a trigger that loops the OLD and NEW values and compares the values and if they are different creates a change string as follows: e.g; FOR EACH field IN NEW

Re: [GENERAL] Is this possible.

2006-03-29 Thread Klint Gore
On Thu, 30 Mar 2006 10:45:20 +1100, "Harvey, Allan AC" <[EMAIL PROTECTED]> wrote: > Hi all, > > Can sombody please help me realise a function, the intent as described by... > > -- Function to create the table for a new point > > CREATE OR REPLACE FUNCTION make_table( varchar ) RETURNS VARCHAR A

Re: [GENERAL] Is this possible or am I on drugs :)

2000-11-28 Thread Ron Chmara
shawn everett wrote: > > What do you consider "passing a parameter to the view" to be? > This is where Microsoft Access has twisted me :) > Access as you may or may not know allows you to use parameters in a query: > SELECT * FROM table WHERE table.pkey=[Enter The Primary Key]; > The bit in [] rep

Re: [GENERAL] Is this possible or am I on drugs :)

2000-11-28 Thread thomas wong
Jeff MacDonald wrote: > If I'm reading correctly your basically just asking "how do i do php ?" > > I'd reccommend any one of the many tutorials on the net, but i'll include a gist.. > > create an HTML form with a text input form. name it "input" > > in your php script connect to the database

Re: [GENERAL] Is this possible or am I on drugs :)

2000-11-27 Thread Tom Lane
shawn everett <[EMAIL PROTECTED]> writes: > The basic select statement for my problem is going to work as follows: > select colA, colB, colA+colB*0.4 as f1, colC, colC+colD*9 as f2 from table > where date=SomeDateEnteredByTheUser; OK, no problem: create view myview as select date, colA, colB, c

Re: [GENERAL] Is this possible or am I on drugs :)

2000-11-27 Thread Tod McQuillin
On Mon, 27 Nov 2000, shawn everett wrote: > select colA, colB, colA+colB*0.4 as f1, colC, colC+colD*9 as f2 from table > where date=SomeDateEnteredByTheUser; CREATE VIEW v1 AS select colA, colB, colA+colB*0.4 as f1, colC, colC+colD*9 as f2, date from table; SELECT colA, colB, f1, colC, f2 FROM

Re: [GENERAL] Is this possible or am I on drugs :)

2000-11-27 Thread shawn everett
> What do you consider "passing a parameter to the view" to be? > This is where Microsoft Access has twisted me :) Access as you may or may not know allows you to use parameters in a query: SELECT * FROM table WHERE table.pkey=[Enter The Primary Key]; The bit in [] represents a prompt to the us

Re: [GENERAL] Is this possible or am I on drugs :)

2000-11-27 Thread Tom Lane
shawn everett <[EMAIL PROTECTED]> writes: > What I'd like to figure out is the best way to handle the say ~30 > calculations I'll need to do to generate the report. I could query the > database and then do the calcuations in code via php, I could do them > using one giant select statement, or I c