Re: point -> double,double ? - Mailing list pgsql-general

From Tom Lane
Subject Re: point -> double,double ?
Date
Msg-id 24563.1042906642@sss.pgh.pa.us
Whole thread Raw
In response to Re: point -> double,double ?  (Greg Stark <gsstark@mit.edu>)
List pgsql-general
Greg Stark <gsstark@mit.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: change in behaviour? Is this a regression in function?
Next
From: "Sziklai Gabor"
Date:
Subject: help on query