Re: refactor CreateTupleDescCopy()

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: refactor CreateTupleDescCopy()
Date: 2003-11-20 20:26:45
Message-ID: 87r802aire.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> I think this is taking the "avoid duplicated code" mantra a little
> far. You've defined a subroutine that returns a TupleDesc that is
> internally inconsistent and cannot usefully be used for anything
> until it's fixed by the parent routines.

Fair enough. Another way to refactor this would be to implement both
CreateTupleDescCopy() and CreateTupleDescCopyConstr() in terms of an
internal function that takes a bool indicating whether or not to
include constraints in the returned TupleDesc. Now that I think about
it, we could also just change the API to remove
CreateTupleDescCopyConstr(), and replace it with an additional bool
parameter to CreateTupleDescCopy().

I'm leaning toward doing the latter, and updating the 30 odd call
sites this would affect. Does that sound good?

-Neil

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-11-20 20:51:20 Re: refactor CreateTupleDescCopy()
Previous Message Tom Lane 2003-11-20 19:43:34 Re: refactor CreateTupleDescCopy()