Search Postgresql Archives

Re: Casting to varchar

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

 




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




[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