Return-Path: owner-postman Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with SMTP id MAA15684 for postgres-redist; Fri, 19 Aug 1994 12:47:07 -0700 Resent-From: POSTGRES mailing list Resent-Message-Id: <199408191947.MAA15684@nobozo.CS.Berkeley.EDU> Sender: owner-postman@postgres.Berkeley.EDU X-Return-Path: owner-postman Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with SMTP id MAA15673; Fri, 19 Aug 1994 12:47:07 -0700 Message-Id: <199408191947.MAA15673@nobozo.CS.Berkeley.EDU> X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol From: aoki@cs.berkeley.edu (Paul M. Aoki) To: Robert.Patrick@cs.cmu.edu Cc: postgres@postgres.Berkeley.EDU Subject: Re: bytea data types Reply-To: aoki@cs.berkeley.edu (Paul M. Aoki) In-reply-to: Your message of Tue, 16 Aug 1994 20:19:56 -0400 (EDT) Date: Fri, 19 Aug 94 12:47:07 -0700 X-Sender: aoki@postgres.Berkeley.EDU Resent-To: postgres-redist@postgres.Berkeley.EDU X-Mts: smtp Resent-Date: Fri, 19 Aug 94 12:47:07 -0700 Resent-XMts: smtp 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. ==============================================================================