> Although, I do find your output very strange. You wrote ORDER BY port, which
> is a text type. Why does Postgres order using the ordering operators of the
> "Port" data type rather than the "text" type, even though you haven't
> performed a cast?
That is an editing mistake. I mean
> hasegeli=# SELECT port FROM device_port ORDER BY cast_to_port(port);