Re: refactor CreateTupleDescCopy() - Mailing list pgsql-patches

From Neil Conway
Subject Re: refactor CreateTupleDescCopy()
Date
Msg-id 87r802aire.fsf@mailbox.samurai.com
Whole thread Raw
In response to Re: refactor CreateTupleDescCopy()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: refactor CreateTupleDescCopy()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane <tgl@sss.pgh.pa.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


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: refactor CreateTupleDescCopy()
Next
From: Tom Lane
Date:
Subject: Re: refactor CreateTupleDescCopy()