pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Buglet?
2+ messages / 2 participants
[nested] [flat]

* Buglet?
@ 2001-03-08 06:16 Christopher Sawtell <csawtell@xtra.co.nz>
  2001-03-08 15:44 ` Re: Buglet? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Christopher Sawtell @ 2001-03-08 06:16 UTC (permalink / raw)
  To: pgsql-sql

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 
<<--




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Buglet?
  2001-03-08 06:16 Buglet? Christopher Sawtell <csawtell@xtra.co.nz>
@ 2001-03-08 15:44 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2001-03-08 15:44 UTC (permalink / raw)
  To: Christopher Sawtell <csawtell@xtra.co.nz>; +Cc: pgsql-sql

Christopher Sawtell <csawtell@xtra.co.nz> writes:
> It that a bug?

You could argue that.  The handling of NULL arrays (not to mention NULLs
in arrays) is pretty brain-d^H^H^H^H^H^Hsimplistic; I don't think the
original designer thought about NULLs at all.

All of the array code could use an overhaul, actually, to move it out of
the student-project category and into the professional-tool category.
I've taken occasional swipes at it over the past couple of years, but
it still leaves a lot to be desired.  Any volunteers out there?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-03-08 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-08 06:16 Buglet? Christopher Sawtell <csawtell@xtra.co.nz>
2001-03-08 15:44 ` Tom Lane <tgl@sss.pgh.pa.us>

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