pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christopher Sawtell <csawtell@xtra.co.nz>
To: pgsql-sql@postgresql.org
Subject: Buglet?
Date: Thu, 8 Mar 2001 19:16:20 +1300
Message-ID: <01030819162000.25266@berty> (raw)

chris=# select *, array_element_count(pupils_on_leave) as 
number_awol_pupils from absence ;
          date          | lesson_number | pupils_on_leave |  pupils_awol  
| number_awol_pupils
------------------------+---------------+-----------------+---------------+--------------------
 2001-03-08 00:00:00+13 |            25 |                 | {4,29,3}      |
 2001-03-08 00:00:00+13 |            26 |                 | {17,27,28,14} |
 2001-03-08 00:00:00+13 |            27 |                 | {5,24,13}     |
 2001-03-08 00:00:00+13 |            12 | {12,34}         | {23}          
|                  2
 2001-03-07 00:00:00+13 |            21 |                 | {4,5,28,15}   |
(5 rows)

As expected.

chris=# update absence set pupils_on_leave[1]=9 where lesson_number=21;
UPDATE 1

Now I tell pg to insert a value in the array, & he says he's done it.

chris=# select *, array_element_count(pupils_on_leave) as 
number_awol_pupils from absence ;
          date          | lesson_number | pupils_on_leave |  pupils_awol  
| number_awol_pupils
------------------------+---------------+-----------------+---------------+--------------------
 2001-03-08 00:00:00+13 |            25 |                 | {4,29,3}      |
 2001-03-08 00:00:00+13 |            26 |                 | {17,27,28,14} |
 2001-03-08 00:00:00+13 |            27 |                 | {5,24,13}     |
 2001-03-08 00:00:00+13 |            12 | {12,34}         | {23}          
|                  2
 2001-03-07 00:00:00+13 |            21 |                 | {4,5,28,15}   
|   
(5 rows)
 
But he has told me a fat fib.

chris=# \d absence
                    Table "absence"
    Attribute    |           Type           | Modifier
-----------------+--------------------------+----------
 date            | timestamp with time zone |
 lesson_number   | integer                  |
 pupils_on_leave | integer[]                |
 pupils_awol     | integer[]                |
 
It that a bug?

It would be very nice for me if that worked.
( you have to put '{}' in the array field before usisng the field[n]=x 
notation. )


-- 
Sincerely etc.,

 NAME       Christopher Sawtell
 CELL PHONE 021 257 4451
 ICQ UIN    45863470
 EMAIL      csawtell @ xtra . co . nz
 CNOTES     ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz

 -->> Please refrain from using HTML or WORD attachments in e-mails to me 
<<--




view thread (2+ messages)  latest in thread

Message-ID: <01030819162000.25266@berty>
Permalink:  ../01030819162000.25266@berty/
Also on:    postgresql.org/message-id/01030819162000.25266@berty

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: csawtell@xtra.co.nz
  Subject: Re: Buglet?
  In-Reply-To: <01030819162000.25266@berty>
  References: <01030819162000.25266@berty>

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

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