agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Paul M. Aoki <aoki@cs.berkeley.edu>
To: Xinguo Wei <wei@u.washington.edu>
Cc: postgres <postgres@postgres.Berkeley.EDU>
Subject: Re: Can't use GetAttributeByName for text type..
Date: Thu, 05 Jan 95 09:12:17 -0800
Message-ID: <199501051712.JAA18330@faerie.CS.Berkeley.EDU> (raw)
In-Reply-To: <Pine.A32.3.91c.950105004448.82192A-100000@homer14.u.washington.edu>

Xinguo Wei <wei@u.washington.edu> writes:
> char name[4];
> strcpy(name,GetAttributeByName(t,"graphic_model", &isnull));

"text" is not a C string.  "text" is

struct varlena {
        int32   vl_len;
        char    vl_dat[1];
};

[...]

typedef struct varlena text;

the data is not NUL-delimited.

(this is not particularly safe code in any case -- what happens if
graphic_model is null?)
--
  Paul M. Aoki          |  University of California at Berkeley
  aoki@CS.Berkeley.EDU  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/



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 using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: aoki@cs.berkeley.edu, wei@u.washington.edu
  Subject: Re: Can't use GetAttributeByName for text type..
  In-Reply-To: <199501051712.JAA18330@faerie.CS.Berkeley.EDU>

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

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