| От | Tom Lane |
|---|---|
| Тема | Oracle-compatible lpad/rpad behavior |
| Дата | |
| Msg-id | 13946.976218690@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | AW: [HACKERS] Re: is it a bug? (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>) |
| Список | pgsql-general |
Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at> writes:
>> lpad and rpad never truncate, they only pad.
>>
>> Perhaps they *should* truncate if the specified length is less than
>> the original string length. Does Oracle do that?
> Yes, it truncates, same as Informix.
I went to fix this and then realized I still don't have an adequate spec
of how Oracle defines these functions. It would seem logical, for
example, that lpad might truncate on the left instead of the right,
ie lpad('abcd', 3, 'whatever') might yield 'bcd' not 'abc'. Would
someone check?
Also, what happens if the specified length is less than zero? Error,
or is it treated as zero?
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера