title: Choose schema of PostgreSQL trigger
body: <p>I have created simple trigger :</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION emplacement_libre() RETURNS TRIGGER AS $BODY$
  
  
  DECLARE
  
  i int;
  curseur CURSOR FOR 
      SELECT COUNT(*) FROM beta2.astres a
      INNER JOIN beta2.planetes p ON a.id = p.astre_id 
      WHERE a.galaxie = NEW.galaxie AND
      a.ss = NEW.ss AND
      a.position = NEW.position;
  
  BEGIN
  
  OPEN curseur;   
  
  LOOP
      FETCH curseur INTO i;
  
      IF i&gt;0 THEN
      RAISE EXCEPTION 'la planète est déjà occupée';
      END IF;
  
      EXIT WHEN NOT FOUND;
  
  END LOOP;
  
  CLOSE curseur;
  
  RETURN NEW;
  
  END;
  
  
  $BODY$ LANGUAGE plpgsql;
  
  
  CREATE TRIGGER emplacement_libre
    BEFORE INSERT OR UPDATE ON beta2.astres
    FOR EACH ROW EXECUTE PROCEDURE emplacement_libre();
  </code></pre>
  
  <p>In PostgreSQL doc, it is written about the name of a trigger :</p>
  
  <blockquote>
    <p>The name to give the new trigger. This must be distinct from the name of any other trigger for the same table. The name cannot be schema-qualified — <strong>the trigger inherits the schema of its table</strong>. For a constraint trigger, this is also the name to use when modifying the trigger's behavior using SET CONSTRAINTS.</p>
  </blockquote>
  
  <p>So I expected my trigger to get schema <code>beta2</code> because I use it in my <code>CREATE TRIGGER</code> request but it's not the case, my trigger is created inside default <code>public</code> schema...why ?</p>