Re: Latitude and Longitude Functions

From: Benjamin Gufler <benjamin.gufler-at-in.tum.de>
Date: Fri, 16 May 2008 08:21:37 +0200


On 2008-05-15 19:03, Patrick Dowler wrote:
> Hmm, you should be able to apply those functions to POINT(...), to a column of
> type point, and to CENTROID(...), but you cannot apply them to a geometry in
> general. The proposed COORDSYS function, on the other hand, can be applied to
> any geometry. So, the argument to LATITUDE et al should be something like:
>
> <lat_args> ::= <point> | <centroid> | <column_reference>

By allowing a <column_reference>, however, it is syntactically possible to pass an arbitrary type to the function. So, the LATITUDE etc. functions have to check the type of their argument at runtime nevertheless. We could thus even say
 <lat_args> ::= <value_expression> | <query_specification> (for "scalar subqueries", i.e. queries returning scalar values)

> My understanding is that it is always the case that the BNF does not actually
> enforce correct column types; the DB has to cast/convert or fail.

That's my understanding too.

Benjamin Received on 2008-05-16Z08:21:45