From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: patch: ALTER TABLE IF EXISTS |
Date: | 2012-01-03 15:59:12 |
Message-ID: | CA+Tgmoa4b1oy4Y7NH1nRvKT4UJVMPdowpExCfJuOcawWm-bVrQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Jan 3, 2012 at 10:38 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> Hello
>
> 2012/1/3 Robert Haas <robertmhaas(at)gmail(dot)com>:
>> On Mon, Jan 2, 2012 at 12:01 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>>> here is updated patch
>>
>> I think the comments in parse_utilcmd.c probably need a bit of adjustment.
>
> I don't see it - there is only one comment and it is adjusted with
> "if" statement.
>
> please, show it
Well, basically, the comment preceding the part you altered say "the
lock level requested here", but "here" is getting spread out quite a
bit more with this code change. Maybe that doesn't matter.
However, on further examination, this is a pretty awkward way to write
the code. Why not something like this:
rel = relation_openrv_extended(stmt->relation, lockmode, stmt->missing_ok);
if (rel == NULL)
{
ereport(...);
return NIL;
}
Maybe the intent of sticking heap_openrv_extended() into the upper
branch of the if statement is to try to bounce relations that aren't
tables, but that's not actually what that function does (e.g. a
foreign table will slip through). And I think if we're going to have
IF EXISTS support for ALTER TABLE at all, we ought to have it for the
whole family of related statements: ALTER VIEW, ALTER SEQUENCE, ALTER
FOREIGN TABLE, etc., not just ALTER TABLE itself.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2012-01-03 16:17:26 | Re: ALTER TABLE lock strength reduction patch is unsafe |
Previous Message | Simon Riggs | 2012-01-03 15:56:12 | Re: our buffer replacement strategy is kind of lame |