pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: ALTER TABLE .. ALTER COLUMN .. ERROR: attribute .. has wrong type
Date: Fri, 06 Jan 2017 17:12:34 -0500
Message-ID: <27953.1483740754@sss.pgh.pa.us> (raw)
In-Reply-To: <20170106213346.vro3rrghuzabnxmv@alvherre.pgsql>
References: <20170106213346.vro3rrghuzabnxmv@alvherre.pgsql>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Tom Lane wrote:
>> Hmm.  The bespoke code for constructing the attno map bothers me;
>> surely there is existing code that does that?  If not, it'd still
>> make more sense to factor it out, I think, because there will be
>> other needs for it in future.

> There isn't any that I could find -- all the existing callers of
> map_variable_attnos build their map in other ways (while walking an
> attribute array at construction time).

[ pokes around... ]  The code I was thinking of is convert_tuples_by_name
in access/common/tupconvert.c.  There's a bit of an API mismatch in that
it wants to wrap the mapping array in a TupleConversionMap struct; but
maybe we could refactor tupconvert.c to offer a way to get just the map
array.

> I also modified the algorithm to use the relcache instead of walking the
> child's attribute list for each parent attribute (that was silly).

Hmm.  That might be better in a big-O sense but I doubt it's faster for
reasonable numbers of columns.

> My rationale when writing the event trigger code was that each command
> would only be published once, for the parent table, not recursively for
> each child.  So only the original expression should be seen.

Oh good; then we're just talking about a localized bug fix and not a
protocol break for event triggers.

			regards, tom lane


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



view thread (27+ messages)  latest in thread

Message-ID: <27953.1483740754@sss.pgh.pa.us>
Permalink:  ../27953.1483740754@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27953.1483740754@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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, pryzby@telsasoft.com, robertmhaas@gmail.com
  Subject: Re: ALTER TABLE .. ALTER COLUMN .. ERROR: attribute .. has wrong type
  In-Reply-To: <27953.1483740754@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