Variable-length Types

From: Itai Zukerman <zukerman(at)math-hat(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Variable-length Types
Date: 2000-10-15 14:00:10
Message-ID: 871yxi432t.fsf@matt.w80.math-hat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2000-10-15 18:31:40 Re: Variable-length Types
Previous Message Indraneel Majumdar 2000-10-13 21:11:36 Re: dynamic object creation