Re: Casting Point to Text - Mailing list pgsql-general

From Tom Lane
Subject Re: Casting Point to Text
Date
Msg-id 29593.1070981803@sss.pgh.pa.us
Whole thread Raw
In response to Casting Point to Text  (Martin Hart <martin@zsdfherg.com>)
Responses Re: Casting Point to Text
List pgsql-general
Martin Hart <martin@zsdfherg.com> writes:
> db=# select '(1,2)'::point::text;
> ERROR:  cannot cast type point to text

> the only way i have been able to achieve it is to write a plpgsql function:
> while this appears to work fine - I am wondering if I am missing something
> fundamental - specifically whether or not there is an inbuilt way to do it
> (which I guess there must be for the plpgsql function to work)?

plpgsql is effectively doing

regression=# select textin(point_out('(1,2)'::point));
 textin
--------
 (1,2)
(1 row)

There is not a one-step cast function for this.  (Not for any
fundamental reason, just a lack of round tuits.)

            regards, tom lane

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Shell access & send email from PLPGSQL?
Next
From: Paul Thomas
Date:
Subject: Re: Select for update Question