Re: [GENERAL] INSERT a number in a column based on other columns OLD INSERTs

2015-06-21 Thread litu16
Yes I have tried with t_ix = 1; or t_ix := 1; I get the same result, it just doesn't do anything, I have also tried with AFTER and BEFORE, when I use BEFORE I get this error ERROR: cannot return non-composite value from function returning composite type CONTEXT: PL/pgPSQL function on_ai_mytable()

Re: [GENERAL] INSERT a number in a column based on other columns OLD INSERTs

2015-06-21 Thread litu16
Hi, thanks yes I was using AFTER, but it only works with BEFORE so finally I got it to work. thanks to all Im just still wondering why here... *BEGIN IF NEW.time_type = 'Start' THEN SELECT t.time_index FROM table_ebscb_spa_log02 t WHERE t.fn_name = NEW.fn_name AND t.time_type = 'Start' ORDE

Re: [GENERAL] INSERT a number in a column based on other columns OLD INSERTs

2015-06-21 Thread Charles Clavadetscher
Hi The two things have nothing in common. With NEW.time_index = t_ix you set the field with a value and with return you return the record (with the modified field) to make the insert. You have to return NEW, because you have a trigger function. The function must return a record of the same typ

Re: [GENERAL] INSERT a number in a column based on other columns OLD INSERTs

2015-06-21 Thread Charles Clavadetscher
Just a final note. If your trigger needs to handle updates or deletes, then you may need to use OLD or both (OLD and NEW) and return OLD instead of NEW, depending on what you want to achieve. You also may return null to avoid the action to be performed, but this only works with "before" trigger

Re: [GENERAL] INSERT a number in a column based on other columns OLD INSERTs

2015-06-21 Thread litu16
Thanks again to all Thanks Charles, fortunately I only need to do INSERTS in my database, however I know I have to read postgreSQL documentation, my respect to programmers who have to learn one language after another, after another, an so on. I just know python and other shorter scripting languague

Re: [GENERAL] INSERT a number in a column based on other columns OLD INSERTs

2015-06-21 Thread Adrian Klaver
On 06/21/2015 12:28 PM, litu16 wrote: Thanks again to all Thanks Charles, fortunately I only need to do INSERTS in my database, however I know I have to read postgreSQL documentation, my respect to programmers who have to learn one language after another, after another, an so on. I just know pyth

Re: [GENERAL] CLOG read problem after pg_basebackup

2015-06-21 Thread Andres Freund
Hi, On 2015-01-23 15:31:15 +0100, Petr Novak wrote: > I'd like to ask for help clarifying an issue I'm having. > > I've recently prepared new servers in another datacenter for some of our > databases which I want to set up as a streaming replicas. There are several > instances(clusters) with size