Re: Problem with partitioning

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: JotaComm <jota(dot)comm(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problem with partitioning
Date: 2016-08-03 21:47:24
Message-ID: 111f497e-1437-3d28-a01d-32e8010770c7@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/03/2016 12:11 PM, JotaComm wrote:
> Hello,
>
> 2016-08-03 15:29 GMT-03:00 Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com
> <mailto:adrian(dot)klaver(at)aklaver(dot)com>>:
>
> On 08/03/2016 11:24 AM, JotaComm wrote:
>
>
>
> 2016-08-03 15:20 GMT-03:00 JotaComm <jota(dot)comm(at)gmail(dot)com
> <mailto:jota(dot)comm(at)gmail(dot)com>
> <mailto:jota(dot)comm(at)gmail(dot)com <mailto:jota(dot)comm(at)gmail(dot)com>>>:
>
>
>
> ​When I create a trigger for each child table the trigger
> works very
> well.​
>
>
> ​​
> Without seeing any code this problem is not going to be solved.
>
>
> ​The trigger code:
>
> tg_table_update AFTER UPDATE ON parent_table FOR EACH ROW EXECUTE
> PROCEDURE f_table_update()
>
> CREATE OR REPLACE FUNCTION f_table_update()
>
> RETURNS TRIGGER AS $$
>
> BEGIN
>
> RAISE NOTICE 'update';
>
> UPDATE parent_table SET date=now() WHERE column_id=OLD.column_id;
>
> RETURN NULL;
>
> END;
>
> $$ LANGUAGE PLPGSQL;

In addition to what Tom said:

This is an AFTER UPDATE trigger so the original UPDATE already occurred.
Is it is expected that the OLD.column_id would still be around in the table?

The fact that you are not seeing the RAISE NOTICE 'update' could be
explained by logging settings.

> ​
>
>
>
>
>
> ​Try:
>
> \d+ <tablename> on the relevant table and check/show the
> "Triggers: " section​.
>
> David J.
>
>
> --
> JotaComm
> http://jotacomm.wordpress.com
>
>
>
>
> --
> JotaComm
> http://jotacomm.wordpress.com
>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>
>
>
> ​Thank you​
>
>
> --
> JotaComm
> http://jotacomm.wordpress.com

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Withers 2016-08-03 22:48:52 connection file descriptors created with identical number after process fork on mac
Previous Message Tom Lane 2016-08-03 19:33:04 Re: Problem with partitioning