Note that there are some explanatory texts on larger screens.

plurals
  1. POPostgresql Partinioned Table Delete Trigger Fails
    primarykey
    data
    text
    <p>I have the following based on another SE question ( Hash Rings On PostgreSql)</p> <pre><code>CREATE TABLE sms.tablename ( id uuid, mdate date ) </code></pre> <p>And the partitions.</p> <pre><code>CREATE TABLE sms.tablename_partition_1 ( CHECK ( sms.hash(id) = '1' ) ) INHERITS (sms.tablename); ... CREATE TABLE sms.tablename_partition_f ( CHECK ( sms.hash(id) = 'f' ) ) INHERITS (sms.tablename); </code></pre> <p>Now here is the problems.</p> <p>When i add this trigger.</p> <pre><code>CREATE TRIGGER "delete_me" BEFORE DELETE ON sms.tablename FOR EACH ROW EXECUTE PROCEDURE sms.delete_me(E'\\x'); CREATE OR REPLACE FUNCTION sms.delete_me() RETURNS trigger AS $BODY$ begin RAISE NOTICE 'HERE !!!'; return OLD; end; $BODY$ LANGUAGE plpgsql VOLATILE SECURITY DEFINER COST 100; </code></pre> <p>This trigger never runs ... I can't see the NOTICE message. Now if i apply the same trigger to another table ( Non-Partitioned ), it works fine it does its job , the row is removed and the notice message pops up.</p> <blockquote> <p>More Info : "PostgreSQL 9.1.6 on i686-pc-linux-gnu, compiled by gcc-4.4.real (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3, 32-bit"</p> </blockquote> <p>I'm just trying to avoid using stored procedures on the table and keeping the ORM Clean.</p> <p><strong>EDITED :</strong></p> <p>1) No Rules Exist On The Table Or Any Of the Tables Inherited , The Same Applied to Indexes Or PK's.</p> <p>2) Running the following command.</p> <pre><code>DELETE FROM sms.tablename WHERE id = 'a5e52a04-282f-4cf4-8347-a43d68725e6b'; </code></pre> <p>3) Full SQL Showing This Problem.</p> <pre><code>http://pastebin.com/mZBFEtaY </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload