Casting macaddr types to text - Mailing list pgsql-general

From Mayers, Philip J
Subject Casting macaddr types to text
Date
Msg-id A0F836836670D41183A800508BAF190B35E2E4@icex1.cc.ic.ac.uk
Whole thread Raw
List pgsql-general
I'm trying to do this:

hdb=> select * from interface where mac like '08:%';
ERROR:  Unable to identify an operator '~~' for types 'macaddr' and
'unknown'
        You will have to retype this query using an explicit cast

There's no like operator (~~) defined for mac. Ok, fine. *BUT*, nor is there
a cast to text either:

hdb=> select * from interface where mac::text like '08:%';
ERROR:  Cannot cast type 'macaddr' to 'text'

Why? It seems clear to me that there is a well-defined cast to text type,
and in the absence of a like operator...

Advice?

Regards,
Phil

+----------------------------------+
| Phil Mayers, Network Support     |
| Centre for Computing Services    |
| Imperial College                 |
+----------------------------------+

pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: : Execute a string of command in sql'script
Next
From: Guillaume Lémery
Date:
Subject: Limited rights for a user