Re: [HACKERS] How do I construct a varlena?

From: Maarten Boekhold <maartenb(at)dutepp2(dot)et(dot)tudelft(dot)nl>
To: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] How do I construct a varlena?
Date: 1998-08-04 14:28:21
Message-ID: Pine.SUN.3.91.980804162700.10981A-100000@dutepp2.et.tudelft.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 4 Aug 1998, Oliver Elphick wrote:

> Can you tell me, please, how to construct a varlena (to be returned by
> a function).
>
> I see it is declared as an int and a 1-byte array; I don't know how to
> assign a longer string in place of that 1-byte array; the compiler
> complains about incompatible types, whatever I do.

If I'm correct:

malloc(sizeof(VARLENA) + l);

where 'l' is the length of the string you want to put in (without the
trailing '\0').

Maarten

_____________________________________________________________________________
| TU Delft, The Netherlands, Faculty of Information Technology and Systems |
| Department of Electrical Engineering |
| Computer Architecture and Digital Technique section |
| M(dot)Boekhold(at)et(dot)tudelft(dot)nl |
-----------------------------------------------------------------------------

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1998-08-04 14:48:51 Re: [HACKERS] indexes and floats
Previous Message William McCracken 1998-08-04 14:09:31 Query based on date/time field