pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
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: Mon, 9 Jan 2017 19:38:07 -0300
Message-ID: <20170109223807.qxuckfwaihh72x2w@alvherre.pgsql> (raw)
In-Reply-To: <26761.1483989025@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Tom Lane wrote:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> > Tom Lane wrote:
> >> [ 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.
> 
> > Ah, nice gadget.  I think the attached patch should do.
> 
> Looks reasonable to me.

Thanks for looking!  Pushed.

> > Hm, I was thinking in unreasonable numbers of columns, keeping in mind
> > that they can appear in arbitrary order in child tables.  Then again,
> > that probably seldom occurs in real databases.  I suppose this could
> > become an issue with table partitioning becoming more common, but I'm
> > okay with deferring the optimization work.
> 
> It occurred to me that it'd be really easy to improve
> convert_tuples_by_name so that, rather than having the inner loop
> start from j = 0 every time, it starts from the attribute after the
> last match (and loops around if needed, so that it still examines
> every child attribute).  I think this would keep it at more-or-less
> linear time for all but very contrived child tables.
> 
> Since your patch is touching that code I won't do anything about it
> right now, but maybe later.

Yeah, I had the same idea.  Looks fiddly but not terribly difficult, and
well localized.  Didn't we have a list of tasks for eager contributors?

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
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)

Message-ID: <20170109223807.qxuckfwaihh72x2w@alvherre.pgsql>
Permalink:  ../20170109223807.qxuckfwaihh72x2w@alvherre.pgsql/
Also on:    postgresql.org/message-id/20170109223807.qxuckfwaihh72x2w@alvherre.pgsql

 · 

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

* 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