Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux