User Profile

Collapse

Profile Sidebar

Collapse
sentenza
sentenza
Last Activity: Jun 9 '10, 02:25 PM
Joined: May 13 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • sentenza
    started a topic problem with variable

    problem with variable

    Hello everyone

    When the trigger executes the function which I copy below:

    Code:
    IF (TG_OP = 'UPDATE') THEN
    EXECUTE 'CREATE TABLE '||NEW.nome_tabella||' (ordinativo serial PRIMARY KEY
    CHECK (nome_tabella = '||NEW.nome_tabella||'::text))
    INHERITS (madre);
    first use of the variable '||NEW.nome_tab ella||' is correct and the table is created with the name, for example "azienda_vallon e",...
    See more | Go to post

  • hi there
    Yesterday I tried, but does not work. when running the update, it write the updated row in all rows of the table azienda_vallone , entirely overwrite all existing rows.
    the guide says to mention in UPDATE only the columns that are modified but in this case is impossible to know first what columns will be modified.

    Sentenza
    See more | Go to post

    Leave a comment:


  • so i must correct the trigger deleting:

    "FROM database_t" ?

    and delete NEW.* from:

    WHERE NEW.intestatari o_pratica = 'AZ. AGR.LA VALLONE'

    then i must use:

    WHERE intestatario_pr atica = 'AZ. AGR.LA VALLONE'; ?


    I'll try tonight.

    thank you very much
    Sentenza
    See more | Go to post

    Leave a comment:


  • Thanks for the answer rski

    here the definition:

    Code:
    CREATE TRIGGER agg_tab_aziende 
    AFTER INSERT OR UPDATE 
    ON database_t
    FOR EACH ROW EXECUTE PROCEDURE trig_agg_tab_aziende();
    last night I tried again with the table "azienda_vallon e" partially populated and does not work correctly. if there are 5 rows of data and I make a change in "database_t ", the trigger overwrites...
    See more | Go to post

    Leave a comment:


  • trigger to distribute the data in other tables (by conditions)

    Here again with other trigger:

    the tables structure of the database:
    "database_t " (master),
    "azienda_vallon e" (SLAVE1),
    "azienda_energy " (SLAVE2 )
    ....
    all tables have identical structure.

    I want to create a trigger that on updates of table "database_t " I update the fields in the table "azienda_vallon e" and on insert in table "database_t "...
    See more | Go to post

  • sentenza
    replied to trigger creating table
    perfect, now it works fine!

    thank you very much!!

    bye Sentenza
    See more | Go to post

    Leave a comment:


  • sentenza
    started a topic trigger creating table

    trigger creating table

    I want to create a function that 'on update' and 'on insert' in table A column nome_tabella create another table named as the record just added in A:
    Code:
    CREATE FUNCTION trig_creazione_tabella() RETURNS trigger AS $$
    	BEGIN
    		IF (TG_OP = 'UPDATE') THEN
    	CREATE TABLE NEW.nome_tabella (id serial NOT NULL, sigla_comune character varying(4));
    		ELSIF (TG_OP = 'INSERT') THEN
    	CREATE TABLE NEW.nome_tabella (id serial
    ...
    See more | Go to post
    Last edited by rski; May 13 '10, 09:10 PM. Reason: Please use tags
No activity results to display
Show More
Working...