Re: Reducing lock strength of adding foreign keys

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: Noah Misch <noah(at)leadboat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reducing lock strength of adding foreign keys
Date: 2014-12-13 10:42:13
Message-ID: 548C1805.3040509@proxel.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/28/2014 01:33 AM, Noah Misch wrote:
> ALTER TRIGGER is not bad; like you say, change pg_get_triggerdef_worker() the
> way commit e5550d5 changed pg_get_constraintdef_worker(). DROP TRIGGER is
> more difficult. pg_constraint.tgqual of a dropped trigger may reference other
> dropped objects, which calls for equipping get_rule_expr() to use the
> transaction snapshot. That implicates quite a bit of ruleutils.c code.

I started looking into this again and fixed
pg_get_constraintdef_worker() as suggested.

But I have no idea how to fix get_rule_expr() since it relies on doing
lookups in the catcache. Replacing these with uncached lookups sounds
like it could cause quite some slowdown. Any ideas?

Indexes should suffer from the same problems since they too have emay
contain expressions but they seem to solve this by having a higher lock
level on DROP INDEX, but I do wonder about the CONCURRENTLY case.

By the way, unless I am mistaken there is currently no protection
against having a concurrent ALTER FUNCTION ... RENAME mess up what is
dumped in by pg_get_triggerdef().

--
Andreas Karlsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2014-12-13 10:50:57 Re: Compression of full-page-writes
Previous Message Pavel Stehule 2014-12-13 10:19:08 moving Orafce from pgFoundry - pgFoundry management