Możesz użyć rpad i lpad funkcji do padania numerów odpowiednio w prawo lub w lewo. Zauważ, że nie działa to bezpośrednio na liczbach, więc będziesz musiał użyć ::char lub ::text aby je rzucić:
SELECT RPAD(numcol::text, 3, '0'), -- Zero-pads to the right up to the length of 3
LPAD(numcol::text, 3, '0') -- Zero-pads to the left up to the length of 3
FROM my_table