Re: ALTER TABLESPACE MOVE command tag tweak

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER TABLESPACE MOVE command tag tweak
Date: 2014-06-13 20:44:42
Message-ID: 10375.1402692282@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> The ALTER TABLESPACE MOVE command affects tables, not tablespaces; and
> as such, I think event triggers should support that command. I'm not
> proposing to change event triggers at this stage, but since IMO we will
> want to do that in 9.5, we need it to have a different command tag than
> plain ALTER TABLESPACE. This is so that check_ddl_tag() can compare
> the tag with ALTER TABLESPACE and say "unsupported", and ALTER
> TABLESPACE MOVE and say "supported". Both are currently spelled the
> same, which will be a problem.

> Therefore I propose the attached patch for 9.4.

Hm. While the specific change here seems harmless enough, the argument
for it seems to me to indicate that the very design is broken. Do you
expect event triggers to distinguish all the different subflavors of
ALTER TABLE, for example, on the basis of the command tag? Backwards
compatibility is going to prevent us from refining the tag strings
that much. So ISTM this concern means what we'd better be thinking
about is some other way for event triggers to find out what they're
dealing with.

A different thought is that what event triggers would probably like
is for this command to be reported to them as a series of
ALTER TABLE SET TABLESPACE events, one per moved table. If it's
done like that then the tag for the outer ALTER TABLESPACE may not
be so important.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-06-13 21:05:51 Re: ALTER TABLESPACE MOVE command tag tweak
Previous Message Alvaro Herrera 2014-06-13 20:31:56 Re: Add CREATE support to event triggers