Re: point -> double,double ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: point -> double,double ?
Date: 2003-01-18 16:17:22
Message-ID: 24563.1042906642@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greg Stark <gsstark(at)mit(dot)edu> writes:
> I guess arrays must be some deep voodoo. [] doesn't show up in the list of
> operators. I would be happy if there was at least some way to trick the parser
> into doing the right thing. I'm surprised something like this doesn't work:

> slo=> select (b[0])[0] from t;
> ERROR: parser: parse error at or near "[" at character 14

Yeah, that was my first thought too. It might not be difficult to make
it work --- there's no production in gram.y to accept this, but if there
were then I think that the rest of the code would do the right thing.

> If [] were a normal operator then other datatypes could define operations
> similar to point and box, but I imagine it's the way it is for some good
> reason in the parser level.

You can make arrays of whatever datatype you want. The issue here
is just that there's a syntactic ambiguity between subscripting an
N-dimensional array and subscripting the element datatype of an
N-1-dimensional array ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-01-18 16:34:55 Re: change in behaviour? Is this a regression in function?
Previous Message jco 2003-01-18 15:39:52 Re: libpq C library Client Interface - select()