pad column with leading zeros or space - Mailing list pgsql-general

From Johnson, Shaunn
Subject pad column with leading zeros or space
Date
Msg-id 73309C2FDD95D11192E60008C7B1D5BB0452DD9E@snt452.corp.bcbsm.com
Whole thread Raw
Responses Re: pad column with leading zeros or space  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general

Howdy:

I'm running Postgres 7.1.3 on Mandrake Linux 8.0 kernel
version 2.4.16.

I am trying to create a table where I need to pad certain
columns.  For example, I have a column where it's defined
as an integer 10 but has to be padded with leading zeros,
so the results should be:

0000200201

instead of

[space]200201

At the same time, I have to define a column similar to char (25),
but left justify it with trailing bytes filled with spaces.

In the end, the entire output of a dump should have a specific
format (like COBOL) where there is a start and end position.

Yeah, well, I don't know why a delimited format wouldn't
help the clients, but it seems that they've hardcode
their process so that the text dump will look *exactly*
as specified.

Can someone point me to the right docs / examples?

Thanks!

-X

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: postgresql 7.2b5 and vserver: statistics sockets
Next
From: Dmitry Alyabyev
Date:
Subject: Re: Permissions on non-owned database