Variable-length Types - Mailing list pgsql-sql

From Itai Zukerman
Subject Variable-length Types
Date
Msg-id 871yxi432t.fsf@matt.w80.math-hat.com
Whole thread Raw
List pgsql-sql
I'm going from the documentation in the Programmer's Guide, chapter 4.

I'd like to have the following type available in Postegres:

typedef struct FullName { char *first; char *last;
} FullName;

According to the docs, it looks like I need to do something like:

typedef struct FullName { int4 len; int first; int last; char data[1];
} FullName;

where data[] stores both first and last names (has two '\0'
terminators in it), and first and last are indexes into data[]?  Is
there a better way to do this?

-itai




pgsql-sql by date:

Previous
From: Itai Zukerman
Date:
Subject: Operator Column
Next
From: Josh Berkus
Date:
Subject: Re: Variable-length Types