#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2015
    Posts
    1
    Rep Power
    0

    connect to different server in trigger


    There are two tables (test_1 and test_2) under the same server, the following trigger method will add the same record into table test_2 when inserting a new record into table test_1.
    Code:
    CREATE OR REPLACE FUNCTION fun_test() 
      RETURNS trigger AS $fun_name$
        BEGIN
          insert into test_2(action,data) values(NEW.action, NEW.data);
          return null;
        END;
    $fun_name$ LANGUAGE plpgsql;
    what should I do if test_1 and test_2 are in different server?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,803
    Rep Power
    352
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags.
    http://forums.devshed.com/misc.php?do=bbcode#code

    Tips on how to ask better questions:
    http://tkyte.blogspot.de/2005/06/how-to-ask-questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

IMN logo majestic logo threadwatch logo seochat tools logo