Richard Simões
Richard Simões

Reputation: 12813

PostgreSQL: Is there a way to have an integer column always output in hexadecimal?

I'd like to store integers in a table in such a way that selection from that table always output those integers in hexadecimal, without having to call to_hex. I tried creating a domain with a cast, only to learn that casts of domains are noops. I suppose this could be done with a view, but do I have any other options?

Upvotes: 0

Views: 81

Answers (1)

Peter Eisentraut
Peter Eisentraut

Reputation: 36759

No, there is no facility to do that. A view sounds like a good solution.

Upvotes: 3

Related Questions