Sender: owner-postgres95@postgres.Berkeley.EDU
X-Return-Path: andrew_yu
Received: from eden.CS.Berkeley.EDU (eden.CS.Berkeley.EDU [128.32.37.56]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with ESMTP id XAA01697 for <postgres95@postgres.Berkeley.EDU>; Sun, 12 Nov 1995 23:15:33 -0800
Received: (andrew@localhost) by eden.CS.Berkeley.EDU (8.6.10/8.6.3) id XAA24750; Sun, 12 Nov 1995 23:14:09 -0800
Date: Sun, 12 Nov 1995 23:14:09 -0800
From: "Andrew K. Yu" <andrew@postgres.Berkeley.EDU>
Message-Id: <199511130714.XAA24750@eden.CS.Berkeley.EDU>
To: cjs@netcom.com, postgres95@postgres.Berkeley.EDU
Subject: Re:  varchar's
Resent-To: postgres95-redist
Resent-Date: Sun, 12 Nov 95 23:15:33 -0800
Resent-From: pglite
Resent-XMts: smtp


> 1) What is the difference between varchar, bpchar, bytea, and text?

varchar correspond to the VARCHAR(n) SQL type and bpchar correspond to the
CHAR(n) SQL type. bpchar is blank-padded to the specified number of characters
(n) while varchar is not. Both of them disallow strings longer than the
specified number of characters.

all of the four types above are "varlena" types (ie. the first four bytes
is the length, followed by the data).

> 2) What does varchar(80) really mean in Postgres95? How is the max-length
>    stored in the system database and enforced?

as I mentioned before, it's implemented as a varlena, just like text. the
max-length is recorded in the pg_attribute table. It gets passed to the
functions manipulating the data type.

>    structure. What would have to be done to create a pascal string type? Or
>    a static length char type where its length would be infered from the 
>    catalogs somehow on a per usage basis?

you need to define a type for each length (eg. char16 is 16 characters).

-andrew

===============================================================================
  To unsubscribe from the Postgres95 mailing list, send mail with the subject
  line "DEL" to "postgres95-request@postgres.Berkeley.EDU". 
============  URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres95/  ===========
