agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Paul M. Aoki <aoki@cs.berkeley.edu>
To: Robert.Patrick@cs.cmu.edu
Cc: postgres@postgres.Berkeley.EDU
Subject: Re: bytea data types
Date: Fri, 19 Aug 94 12:47:07 -0700
Message-ID: <199408191947.MAA15673@nobozo.CS.Berkeley.EDU> (raw)
In-Reply-To: <wiIJSg_00hMdAid31E@cs.cmu.edu>

Robert.Patrick@cs.cmu.edu writes:
> Postgres has a built-in byte array type (bytea).  My question is how do
> I use this type?  For example, let's say I have a small GIF file (or any
> other binary data) that I want to store as a byte array.
> create images (id =int4, contents=bytea)
> append images (id=1234, contents=?????????)
> What I really want to know is:
> 1.) What goes where the "??????????" are?

in general, if you want to know exactly what the syntax for a type
is, look in src/utils/adt (in this case, varlena.c).  the syntax
for bytea appears to be the same as for strings (characters for
printables, \xxx for non-printables).  i think i would use large
objects instead.

> 2.) If this can be done, is the big-endian, little-endian problem
>           handled by Postgres or do I have to do it myself? 

postgres does (almost) no byteswapping anywhere, including the 
network connections.
--
  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.
==============================================================================



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, Robert.Patrick@cs.cmu.edu
  Subject: Re: bytea data types
  In-Reply-To: <199408191947.MAA15673@nobozo.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