| От | Richard Huxton |
|---|---|
| Тема | Re: SELECT CAST(123 AS char) -> 1 |
| Дата | |
| Msg-id | 47B3367D.6050808@archonet.com обсуждение исходный текст |
| Ответ на | Re: SELECT CAST(123 AS char) -> 1 (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-general |
Tom Lane wrote: > Richard Huxton <dev@archonet.com> writes: >> [ proof that cast(123 as char) actually produces varchar in mysql ] > > Egad. I wonder if they think this is a feature? Well, presumably its what all the other "convenient" (for Ken's particular problem) databases do. The only alternative I could see would be to use a varchar while casting values and then check lengths at the end before re-casting to e.g. char(6). Interestingly, it must have some lookup table mapping numeric types to lengths of varchar because a standard int gives you varchar(11) whereas an expression that pushes you beyond 32 bits gives varchar(32) and a tinyint gives you varchar(4). Clearly some thought has gone into this. -- Richard Huxton Archonet Ltd
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера