Re: Casting to varchar

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
Cc: Postgresql General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Casting to varchar
Date: 2007-05-04 21:30:18
Message-ID: 7546E019-BAE0-4023-BCF3-04E99633CB1C@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On May 4, 2007, at 15:34 , Scott Ribe wrote:

> Are there any other standard types that can't be cast
> to varchar?

You already got an answer to the first part of your question, but I
thought you might be interested in the second as well. Here's what I
did:

SELECT DISTINCT cast_from
FROM pg_cast c
NATURAL JOIN (
SELECT oid as castsource, typname as cast_from
FROM pg_type
) s
WHERE NOT EXISTS (
SELECT 1
FROM pg_cast i
NATURAL JOIN (
SELECT oid as casttarget, typname as cast_target
FROM pg_type
) t
WHERE cast_target = 'text'
AND i.castsource = c.castsource
)
ORDER BY cast_from;

cast_from
--------------
abstime
bit
bool
box
circle
lseg
path
polygon
regclass
regoper
regoperator
regproc
regprocedure
regtype
reltime
text
varbit
(17 rows)

I don't know which of those you'd consider standard, but I believe
that's a complete list from HEAD of a few minutes ago.

Michael Glaesemann
grzm seespotcode net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-05-04 21:45:56 Re: varchar as primary key
Previous Message Dave Page 2007-05-04 21:04:13 Re: R: Postgres 8.3-dev