Suppose I have two tables in Postgres:
Name: table_rad
Column    Type   
id        integer
username  character varying(64)
Name: table_mac
Column    Type
id        integer
mac       macaddr
I want to make a connection:
SELECT * FROM table_rad WHERE username = mac;
Postgres will complain:
ERROR: operator does no exist: character varying = macaddr
LINE 1: ...ELECT * from table_rad WHERE username = mac;
                                                 ^    
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
So far. I found a solution to solve the problem, and I know that I need CAST. But how can I impose a macaddr type like varhcar?
source
share