Subject: Arrays in Postgres

From: [email-masked] (Eric de Jonge)
Date: Tue, 29 Mar 1994 11:14:49 +0200 (MET DST)

To all Postgres users,

Postgres version 4.1

In the monitor:
==============

* create sal_emp(name=char[], pay = int4[4])\g

* append sal_emp(name="bill", pay="{1}")\g

* retrieve (sal_emp.all)\g

Query sent to backend is "retrieve (sal_emp.all)"
-----------------------------
| name        | pay         |
-----------------------------
| billlll     | {}          |           <=================
-----------------------------

=====================================
WHAT'S THIS (1 element = 0 element ?)
=====================================

* append sal_emp(name="billlll", pay="{1,2,3,4,5}")\g

* append sal_emp(name="billlll", pay="{1,2,3,4,5,6,7,8,9,10}")\g

* retrieve (sal_emp.all)\g

Query sent to backend is "retrieve (sal_emp.all)"
-----------------------------
| name        | pay         |
-----------------------------
| billlll     | {}          |
-----------------------------
| billlll     | {1,2,3,4,5} |                <============
-----------------------------
| billlll     | {1,2,3,4,5,6,7,8,9,10}|      <============
-----------------------------

===============================
AND THIS (> 4 elements)
===============================

It isn't checked ???!!!

Eric de Jonge

---

From: [email-masked] (Paul M. Aoki)
Date: Tue, 29 Mar 94 12:02:18 -0800

[email-masked] (Eric de Jonge) writes:
[postgres 4.1 arrays]
> Query sent to backend is "retrieve (sal_emp.all)"

this bug was noted a while ago -- workaround: it is wise to quote 
all array elements in 4.1.

there was an even neater bug in 4.0.1..

correct.  pretend that the 4.x (x<2) user manual doesn't ever use
the words "fixed length array".  they don't exist.

arrays have been totally reimplemented in 4.2.
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  [email-masked]
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki