Re: Getting rid of pre-assignment of index names in CREATE TABLE LIKE

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Getting rid of pre-assignment of index names in CREATE TABLE LIKE
Date: 2012-07-16 16:58:49
Message-ID: CA+TgmoZch6rAvu_t41sDu1_zi8z21+epPA48cpd0LMtbs4Egow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 16, 2012 at 12:43 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Sat, Jul 14, 2012 at 4:02 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> I suggested that we could dodge the problem by allowing IndexStmt to
>>> carry a comment to be attached to the new index, and thereby avoid
>>> needing an explicit COMMENT command. Attached is a patch that fixes it
>>> that way.
>
>> I agree with this approach. I think it's pretty much always a bad
>> idea for DDL command A to fake up a parse node of the type used by DDL
>> command B. It tends to make the code ugly and unmaintainable and
>> propagates nasty abstraction violations all over the place.
>
> Hmm, well, if that's the argument for doing this then we really need to
> throw away the entire implementation of CREATE TABLE LIKE, because it's
> doing that all over the place; I'm only proposing to remove one specific
> instance.

The problem isn't confined to CREATE TABLE LIKE; it's a widespread
design flaw that will likely take years of work to clean up
completely. I don't think that's a reason not to commit your change
though; it fixes a bug and is an incremental improvement, even if a
small one. That having been said, if you're feeling an urge to tackle
the problem more broadly, don't let me stand in your way...

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-07-16 17:10:49 Re: Getting rid of pre-assignment of index names in CREATE TABLE LIKE
Previous Message Tom Lane 2012-07-16 16:57:39 Re: [PERFORM] DELETE vs TRUNCATE explanation