Re: point -> double,double ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: point -> double,double ?
Дата
Msg-id 24563.1042906642@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: point -> double,double ?  (Greg Stark <gsstark@mit.edu>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: change in behaviour? Is this a regression in function?
Следующее
От: "Sziklai Gabor"
Дата:
Сообщение: help on query