Re: text to point conversion not working. ( cannot cast type text to point )

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: text to point conversion not working. ( cannot cast type text to point )
Дата
Msg-id 20060928102805.GC10591@svana.org
обсуждение исходный текст
Ответ на text to point conversion not working. ( cannot cast type text to point )  (Dan Libby <dan@libby.com>)
Список pgsql-general
On Wed, Sep 27, 2006 at 08:14:29PM -0600, Dan Libby wrote:
> Hi all,
>
> Using pgsql 8.0.1
>
> I'm just starting with using the geometry data types in postgres, and ran into
> what seems like a very basic problem.  Namely, I can't seem to convert/cast
> type text into type point when that text results from any expression.  Ie, it
> *only* works for a plain string literal.

String literals are not text. You can however cheat a little like so:

# SELECT point_in( textout ( '1' || ',2' ) );
 point_in
----------
 (1,2)
(1 row)

textout turns a text value to a "string literal" (sort of) which is
then parsed by the point input function.

If you want you can encapsulate this into a function and create the
cast yourself.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: "Adnan DURSUN"
Дата:
Сообщение: Can i see server SQL commands ?
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Definition of return types for own functions?