pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Itai Zukerman <zukerman@math-hat.com>
To: pgsql-sql@postgresql.org
Subject: Variable-length Types
Date: 15 Oct 2000 10:00:10 -0400
Message-ID: <871yxi432t.fsf@matt.w80.math-hat.com> (raw)

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





view thread (10+ messages)  latest in thread

Message-ID: <871yxi432t.fsf@matt.w80.math-hat.com>
Permalink:  ../871yxi432t.fsf@matt.w80.math-hat.com/
Also on:    postgresql.org/message-id/871yxi432t.fsf@matt.w80.math-hat.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: zukerman@math-hat.com
  Subject: Re: Variable-length Types
  In-Reply-To: <871yxi432t.fsf@matt.w80.math-hat.com>
  References: <871yxi432t.fsf@matt.w80.math-hat.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox