Re: AW: [HACKERS] Re: Regress tests reveal *serious* psql bug

From: Adriaan Joubert <a(dot)joubert(at)albourne(dot)com>
To: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
Cc: "'pgsql-hackers(at)postgreSQL(dot)org'" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: AW: [HACKERS] Re: Regress tests reveal *serious* psql bug
Date: 2000-01-13 16:42:31
Message-ID: 387E0077.2F6D206C@albourne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Zeugswetter Andreas SB wrote:

> > SELECT arrtest.a[1:3],
> > arrtest.b[1:1][1:2][1:2],
> > arrtest.c[1:2],
> > arrtest.d[1:1][1:2]
> > FROM arrtest;
>
> Sorry for the stupid question, but can sombody enlighten me.
> Why was the ":" used in the first place ? I would expect to use a ','
> for an array slice. No ?
>
> As in: select arrtest.a[1,1][1,2]
> (This is also what others use for array slices)

In Fortran 90 (one of the few languages that has true arrays with a size
as well as a shape) arrays are indexed as

A(1:8:2, -2:10)

which would mean the 2D array defined by rows (1,3,5,7) and columns
(-2,...,10). So ',' is commonly used to separate dimensions, and it
would be confusing to suddenly use commas to define a range. And as
Fortran is pretty much the grand-daddy of all programming languages we
can't really go and change that ;-) Putting indexes in separate ['s is
just a modern C'ism, because C has no real multi-dimensional arrays,
only pointer dereferencing.

Adriaan (a Fortran programmer)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-01-13 16:47:56 Re: [HACKERS] TODO list updated
Previous Message Tom Lane 2000-01-13 16:40:32 Re: AW: [HACKERS] Re: Regress tests reveal *serious* psql bug