Hi, I've created my own datatype for Postgres. I have found it necessary to be able to convert it to text, so I could match it up with a text column in a UNION. I figured Postgres would do this for me, but then, I'm naive. Can someone give me a hint, or point me to the appropriate material on how to get "value::text" to work with my new type? Thanks, Mark
Mark Volpe <volpe.mark@epamail.epa.gov> writes:
> someone give me a hint, or point me to the appropriate material on how to get
> "value::text" to work with my new type?
Write a function "text(yourtype) RETURNS text", and the parser will use
it for type coercions from yourtype to text. In general any type
coercion can be provided this way --- a function of a single argument,
having the same name as its return type, represents a coercion path.
regards, tom lane
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера