Skip site navigation (1) Skip section navigation (2)

Re: ADD/DROP INHERITS

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-patches(at)postgresql(dot)org
Subject: Re: ADD/DROP INHERITS
Date: 2006-06-10 16:43:17
Message-ID: 873bedgdwa.fsf@stark.xeocode.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Greg Stark <gsstark(at)mit(dot)edu> writes:
> >    I also haven't checked the constraint name. To do so it would make sense to
> >    use a small hash table.
> 
> No, it'd make sense to use strcmp().  It's unlikely that there will be
> enough constraints attached to any one table to justify use of any but
> the simplest algorithm.  AFAICS you should just iterate through the
> child constraints looking for matches ... and I'd suggest checking the
> name first, as that will save a whole lot more work in reverse-compiling
> than any amount of tenseness in the matching code.

So should I set up a nested scan, essentially implementing a nested loop? or
should I gather together all the children in a list? My inclination is to
avoid the repeated scans and gather them together in a list of cons cells of
the two strings. Or can I stuff the whole tuple in the list elements? I'm
unclear on the memory management of tuples in the midst of a scan; would I
have to copy them?

Are the scans less expensive than I imagine and there's no point in storing
the results? 

And are there any other fields of pg_constraint that I should be checking for
matches in? Do we care if a parent table has a non-deferrable constraint and
the child has a deferrable one, or if the parent's is deferred by default and
the child isn't?


> >    I'm ignoring unique, primary key, and foreign key constraints on the theory
> >    that these things don't really work on inherited tables yet
> >    anyways.
> 
> Yeah, the consistent thing to do with these is nothing, until something
> is done about the generic problem.

It seems to me that foreign key constraints ought to be copied even now
though.

Also, it seems to me that LIKE ought to copy constraints or at least have an
option to. Otherwise it's not really suitable for creating partitions which
would be sad since it seems perfect for that task.

-- 
greg


In response to

Responses

pgsql-hackers by date

Next:From: Joshua D. DrakeDate: 2006-06-10 16:43:33
Subject: Re: Ranges for well-ordered types
Previous:From: Martijn van OosterhoutDate: 2006-06-10 16:31:08
Subject: Re: Latest timezone data in 8.1.4

pgsql-patches by date

Next:From: Tom LaneDate: 2006-06-10 17:00:38
Subject: Re: ADD/DROP INHERITS
Previous:From: Tom LaneDate: 2006-06-10 16:23:06
Subject: Re: ADD/DROP INHERITS

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group