pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Vitaly Burovoy <vitaly.burovoy@gmail.com>
Cc: joel.traf@magwerks.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: bug error message constraint "con_item_id_costelement" for table "costs" does not exist SQL state: 42704
Date: Thu, 28 Jul 2016 12:05:11 -0400
Message-ID: <19144.1469721911@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKOSWN=zerBHmt4e4FQ_MEwZxtDvVRZYVg83+RyfN7DCfNWKGQ@mail.gmail.com>
References: <20160728151154.AABE64016B@smtp.hushmail.com>
	<CAKOSWN=zerBHmt4e4FQ_MEwZxtDvVRZYVg83+RyfN7DCfNWKGQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Vitaly Burovoy <vitaly.burovoy@gmail.com> writes:
> On 7/28/16, joel.traf@magwerks.com <joel.traf@magwerks.com> wrote:
>> The documentation states "create temp table mytable (including all) "
>> is suppose to create all the constraints

> CREATE TABLE ... (LIKE ...)
> creates indexes and constraints with names as if they weren't given
> (i.e. by default), so your
> constraint "con_item_id_costelement" becomes
> "costs_cost_item_id_cost_costelem_id_key"

There's a comment in generateClonedIndexStmt about that:

	 * We don't try to preserve the name of the source index; instead, just
	 * let DefineIndex() choose a reasonable name.

However, this isn't documented anywhere user-visible AFAICS, and it
probably should be.

It's rather annoying that LIKE doesn't duplicate names of constraints,
especially now that we've invented ON CONFLICT and thereby made constraint
names something that would be explicitly referenced in DML code.  However,
I'm afraid that doing so is harder than it looks because index names have
to be unique within a schema.  If we tried to copy constraint names we'd
get a failure anytime the new table is in the same schema as the LIKE
source table.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (6+ messages)  latest in thread

Message-ID: <19144.1469721911@sss.pgh.pa.us>
Permalink:  ../19144.1469721911@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19144.1469721911@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, vitaly.burovoy@gmail.com, joel.traf@magwerks.com
  Subject: Re: bug error message constraint "con_item_id_costelement" for table "costs" does not exist SQL state: 42704
  In-Reply-To: <19144.1469721911@sss.pgh.pa.us>
  References: <20160728151154.AABE64016B@smtp.hushmail.com> <CAKOSWN=zerBHmt4e4FQ_MEwZxtDvVRZYVg83+RyfN7DCfNWKGQ@mail.gmail.com> <19144.1469721911@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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