# So you do not have to create a database with your role name
psql -U Username DatabaseName
psql -d template1
# if your database is different as your login name you must add the database name
psql -U Username DatabaseName
If the field is already a string, this will work
SELECT RIGHT('000'+ISNULL(field,''),3)
If you want nulls to show as '000'
It might be an integer -- then you would want
SELECT RIGHT('000'+CAST(field AS VARCHAR(3)),3)