Обсуждение: changing enumlabel from a NameData to text
Hi all, I'm new to the postgresql codebase, working on a patch to 8.3.7 to allow enums to accept variable length values for David Andersen (see http://archives.postgresql.org/pgsql-performance/2008-07/msg00226.php for more details). The code I wrote compiles, but breaks in a few places. For example I segfault when I try to insert enumlabels with less than 126 bytes. My guess is that I am not understanding the new varvarlena stuff in 8.3, wondering if someone could point me to an explanation of how it works?
Mike Wilson wrote: > Hi all, > > I'm new to the postgresql codebase, working on a patch to 8.3.7 to > allow enums to accept variable length values for David Andersen (see > http://archives.postgresql.org/pgsql-performance/2008-07/msg00226.php > for more details). The code I wrote compiles, but breaks in a few > places. For example I segfault when I try to insert enumlabels with > less than 126 bytes. My guess is that I am not understanding the new > varvarlena stuff in 8.3, wondering if someone could point me to an > explanation of how it works? > > Hmm. Are you aware of enumkit, the precursor to built-in enums? That should still work for 8.3 (and if it doesn't, I'll make sure it's fixed.) and there should be no limit on label length. Maybe that would work for you without any patching of 8.3 required. The downside is that it has to be compiled and installed for each set of enum labels, but you don't have to write any code. see <http://pgfoundry.org/projects/enumkit/> cheers andrew
Looks like David is generating his database from CSVs nightly also he is paying me to write this patch partly because he can't/doesn't want to learn how to compile code. That being said thx for the suggestion, I'll pass it along to him. On Wed, Jul 15, 2009 at 12:56 PM, Andrew Dunstan<andrew@dunslane.net> wrote: > > > Mike Wilson wrote: >> >> Hi all, >> >> I'm new to the postgresql codebase, working on a patch to 8.3.7 to >> allow enums to accept variable length values for David Andersen (see >> http://archives.postgresql.org/pgsql-performance/2008-07/msg00226.php >> for more details). The code I wrote compiles, but breaks in a few >> places. For example I segfault when I try to insert enumlabels with >> less than 126 bytes. My guess is that I am not understanding the new >> varvarlena stuff in 8.3, wondering if someone could point me to an >> explanation of how it works? >> >> > > Hmm. Are you aware of enumkit, the precursor to built-in enums? That should > still work for 8.3 (and if it doesn't, I'll make sure it's fixed.) and there > should be no limit on label length. Maybe that would work for you without > any patching of 8.3 required. The downside is that it has to be compiled and > installed for each set of enum labels, but you don't have to write any code. > > see <http://pgfoundry.org/projects/enumkit/> > > cheers > > andrew >