pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Propagate trigger arguments to partitions
6+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2019-07-10 2ede93de9e  Fix compile failure
* pgsql: Propagate trigger arguments to partitions
@ 2019-07-09 21:23 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Alvaro Herrera @ 2019-07-09 21:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Propagate trigger arguments to partitions

We were creating the cloned triggers with an empty list of arguments,
losing the ones that had been specified by the user when creating the
trigger in the partitioned table.  Repair.

This was forgotten in commit 86f575948c77.

Author: Patrick McHardy
Reviewed-by: Tomas Vondra
Discussion: https://postgr.es/m/20190709130027.amr2cavjvo7rdvac@access1.trash.net
Discussion: https://postgr.es/m/15752-123bc90287986de4@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2c84ea6cf994f5853de0f03600aa5df8156cf9f4

Modified Files
--------------
src/backend/commands/tablecmds.c       | 23 ++++++++++++++++++++++-
src/backend/commands/trigger.c         |  1 -
src/test/regress/expected/triggers.out | 24 ++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 23 +++++++++++++++++++++++
4 files changed, 69 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Propagate trigger arguments to partitions
@ 2019-07-09 21:23 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Alvaro Herrera @ 2019-07-09 21:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Propagate trigger arguments to partitions

We were creating the cloned triggers with an empty list of arguments,
losing the ones that had been specified by the user when creating the
trigger in the partitioned table.  Repair.

This was forgotten in commit 86f575948c77.

Author: Patrick McHardy
Reviewed-by: Tomas Vondra
Discussion: https://postgr.es/m/20190709130027.amr2cavjvo7rdvac@access1.trash.net
Discussion: https://postgr.es/m/15752-123bc90287986de4@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ae0a2945b45ce63b7945284a7ddbb3e1c286fe95

Modified Files
--------------
src/backend/commands/tablecmds.c       | 23 ++++++++++++++++++++++-
src/backend/commands/trigger.c         |  1 -
src/test/regress/expected/triggers.out | 24 ++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 23 +++++++++++++++++++++++
4 files changed, 69 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Propagate trigger arguments to partitions
@ 2019-07-09 21:23 Alvaro Herrera <alvherre@alvh.no-ip.org>
  2019-07-10 07:01 ` Re: pgsql: Propagate trigger arguments to partitions Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 6+ messages in thread

From: Alvaro Herrera @ 2019-07-09 21:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Propagate trigger arguments to partitions

We were creating the cloned triggers with an empty list of arguments,
losing the ones that had been specified by the user when creating the
trigger in the partitioned table.  Repair.

This was forgotten in commit 86f575948c77.

Author: Patrick McHardy
Reviewed-by: Tomas Vondra
Discussion: https://postgr.es/m/20190709130027.amr2cavjvo7rdvac@access1.trash.net
Discussion: https://postgr.es/m/15752-123bc90287986de4@postgresql.org

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1637d959d618886ac6ca59cc3c3785ce5ba06b40

Modified Files
--------------
src/backend/commands/tablecmds.c       | 23 ++++++++++++++++++++++-
src/backend/commands/trigger.c         |  1 -
src/test/regress/expected/triggers.out | 24 ++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 23 +++++++++++++++++++++++
4 files changed, 69 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Propagate trigger arguments to partitions
  2019-07-09 21:23 pgsql: Propagate trigger arguments to partitions Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2019-07-10 07:01 ` Michael Paquier <michael@paquier.xyz>
  2019-07-10 12:53   ` Re: pgsql: Propagate trigger arguments to partitions Alvaro Herrera <alvherre@2ndquadrant.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Michael Paquier @ 2019-07-10 07:01 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-committers@lists.postgresql.org

Hi Alvaro,

On Tue, Jul 09, 2019 at 09:23:45PM +0000, Alvaro Herrera wrote:
> Propagate trigger arguments to partitions
> 
> We were creating the cloned triggers with an empty list of arguments,
> losing the ones that had been specified by the user when creating the
> trigger in the partitioned table.  Repair.
> 
> This was forgotten in commit 86f575948c77.

This commit has broken the buildfarm on REL_11_STABLE for a couple of
animals:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=prion&dt=2019-07-10%2006%3A27%3A02

/home/ec2-user/bf/root/REL_11_STABLE/pgsql.build/../pgsql/src/backend/commands/tablecmds.c:
In function ‘CloneRowTriggersToPartition’:
/home/ec2-user/bf/root/REL_11_STABLE/pgsql.build/../pgsql/src/backend/commands/tablecmds.c:15283:4:
error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (int i = 0; i < trigForm->tgnargs; i++)

This gets fixed with the attached.  I would personally keep the code
consistent for v12 and HEAD for this code path, but I am fine to let
you decide the way you prefer.
--
Michael

Attachments:

buildfarm-fix-11.patch (text/x-diff, 784B) download diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 5fbe7242c4..70bbe052e1 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -15271,6 +15271,7 @@ CloneRowTriggersToPartition(Relation parent, Relation partition) if (trigForm->tgnargs > 0) { char *p; + int i; value = heap_getattr(tuple, Anum_pg_trigger_tgargs, RelationGetDescr(pg_trigger), &isnull); @@ -15280,7 +15281,7 @@ CloneRowTriggersToPartition(Relation parent, Relation partition) p = (char *) VARDATA_ANY(DatumGetByteaPP(value)); - for (int i = 0; i < trigForm->tgnargs; i++) + for (i = 0; i < trigForm->tgnargs; i++) { trigargs = lappend(trigargs, makeString(pstrdup(p))); p += strlen(p) + 1;
signature.asc (application/pgp-signature, 832B) download ^ permalink raw reply [nested|flat] 6+ messages in thread

* Re: pgsql: Propagate trigger arguments to partitions
  2019-07-09 21:23 pgsql: Propagate trigger arguments to partitions Alvaro Herrera <alvherre@alvh.no-ip.org>
  2019-07-10 07:01 ` Re: pgsql: Propagate trigger arguments to partitions Michael Paquier <michael@paquier.xyz>
@ 2019-07-10 12:53   ` Alvaro Herrera <alvherre@2ndquadrant.com>
  2019-07-10 13:11     ` Re: pgsql: Propagate trigger arguments to partitions Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 6+ messages in thread

From: Alvaro Herrera @ 2019-07-10 12:53 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org

On 2019-Jul-10, Michael Paquier wrote:

Hello

> This commit has broken the buildfarm on REL_11_STABLE for a couple of
> animals:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=prion&dt=2019-07-10%2006%3A27%3A02

Argh.  You say "a couple", you mean "half the buildfarm for that branch"
:-(

> error: ‘for’ loop initial declarations are only allowed in C99 mode
>     for (int i = 0; i < trigForm->tgnargs; i++)
> 
> This gets fixed with the attached.  I would personally keep the code
> consistent for v12 and HEAD for this code path, but I am fine to let
> you decide the way you prefer.

I kinda like block-scoped variables, braindead though they are in
C, so I'll just patch pg11.  It's not like this code changes too much
anyway (famous last words).

Thanks for pinging

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Propagate trigger arguments to partitions
  2019-07-09 21:23 pgsql: Propagate trigger arguments to partitions Alvaro Herrera <alvherre@alvh.no-ip.org>
  2019-07-10 07:01 ` Re: pgsql: Propagate trigger arguments to partitions Michael Paquier <michael@paquier.xyz>
  2019-07-10 12:53   ` Re: pgsql: Propagate trigger arguments to partitions Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2019-07-10 13:11     ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2019-07-10 13:11 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: pgsql-committers@lists.postgresql.org

On Wed, Jul 10, 2019 at 08:53:36AM -0400, Alvaro Herrera wrote:
> I kinda like block-scoped variables, braindead though they are in
> C, so I'll just patch pg11.  It's not like this code changes too much
> anyway (famous last words).

Thanks!  That's fine by me.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2019-07-10 13:11 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-07-09 21:23 pgsql: Propagate trigger arguments to partitions Alvaro Herrera <alvherre@alvh.no-ip.org>
2019-07-09 21:23 pgsql: Propagate trigger arguments to partitions Alvaro Herrera <alvherre@alvh.no-ip.org>
2019-07-09 21:23 pgsql: Propagate trigger arguments to partitions Alvaro Herrera <alvherre@alvh.no-ip.org>
2019-07-10 07:01 ` Michael Paquier <michael@paquier.xyz>
2019-07-10 12:53   ` Alvaro Herrera <alvherre@2ndquadrant.com>
2019-07-10 13:11     ` Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox