Casting Point to Text

From: Martin Hart <martin(at)zsdfherg(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Casting Point to Text
Date: 2003-12-09 11:06:39
Message-ID: 200312091106.39774.martin@zsdfherg.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi all,

PG 7.4 beta4 (not had a chance to upgrade yet :-(

how do i cast something of type point to text?

db=# select '(1,2)'::point::text;
ERROR: cannot cast type point to text
db=# select text('(1,2)'::point);
ERROR: function text(point) does not exist
HINT: No function matches the given name and argument types. You may need to
add explicit type casts.

the only way i have been able to achieve it is to write a plpgsql function:
create function to_s(point) returns text as 'begin return $1; end;' language
plpgsql;

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)?

thanks for your help
Martin

Responses

Browse pgsql-general by date

  From Date Subject
Next Message H A Prahalad 2003-12-09 11:10:04 cancel query
Previous Message Harald Fuchs 2003-12-09 10:44:28 Re: Perl / mod_perl / PostgreSQL was: Good open source mailing list system PHP / Postgresql