Re: Operation on bit strings with different length
От
Peter Eisentraut
Тема
Re: Operation on bit strings with different length
Дата
Msg-id
Pine.LNX.4.30.0112181721220.637-100000@peter.localdomain
Ответ на
Operation on bit strings with different length (S P Arif Sahari Wibowo)
Список
Дерево обсуждения
Operation on bit strings with different length S P Arif Sahari Wibowo <arifsaha@yahoo.com>
Re: Operation on bit strings with different length Peter Eisentraut <peter_e@gmx.net>
S P Arif Sahari Wibowo writes: > Do you know how to operate (AND, OR, etc.) on bit strings with > dynamically different length? It is dynamic, means the length won't be > determined until run time. > Is there any function to extend the length of a bit string to a certain > length? Something along the lines of SUBSTRING ( your_value || B'000000000000...long enough...000' FROM 1 FOR max_length ) The reason this is not done automatically is that it's not clear whether the extension should be to the left or to the right. Either of these could be appropriate, depending on whether you consider bit strings to be strings or numbers. Once you know what you want in your application you can wrap the above into a function. To generate a generic "long enough" value, look at the REPEAT function. -- Peter Eisentraut peter_e@gmx.net
В списке pgsql-sql по дате отправления