Problems with Blank space

Started by Eric, Audetover 24 years ago5 messagesgeneral
Jump to latest
#1Eric, Audet
eaudet@scc.ca

I am not sure if this is a database issue or a DBI::Pg issue.

When I do a select * from tablea .... all fields specified as fix length
text field ... return the data with blank space.

Example:
"Eric" returns "Eric****************" where * are blank spaces.

Is this normal?

Eric

#2Mitch Vincent
mvincent@cablespeed.com
In reply to: Eric, Audet (#1)
Re: Problems with Blank space

Yes, if you're using fixed-length fields then the value is padded out to the
length that the field is fixed to :-)

I'm sure Perl has some facility for stripping NULLs off of strings, I
suggest using it here or changing the data type in PG...

Good luck!!

Show quoted text

I am not sure if this is a database issue or a DBI::Pg issue.

When I do a select * from tablea .... all fields specified as fix length
text field ... return the data with blank space.

Example:
"Eric" returns "Eric****************" where * are blank spaces.

Is this normal?

Eric

#3Joe Conway
mail@joeconway.com
In reply to: Eric, Audet (#1)
Re: Problems with Blank space

I am not sure if this is a database issue or a DBI::Pg issue.

When I do a select * from tablea .... all fields specified as fix length
text field ... return the data with blank space.

Example:
"Eric" returns "Eric****************" where * are blank spaces.

Is this normal?

Yes, use varchar() or text instead of char() if you don't want the spaces.
See:

http://www.postgresql.org/idocs/index.php?datatype-character.html

HTH,

-- Joe

#4Noname
wsheldah@lexmark.com
In reply to: Joe Conway (#3)
Re: Problems with Blank space

Perl to strip trailing whitespace from a variable:
$name =~ s/\s+$//;

"Mitch Vincent" <mvincent%cablespeed.com@interlock.lexmark.com> on 08/07/2001
03:26:31 PM

To: "Eric, Audet" <eaudet%scc.ca@interlock.lexmark.com>,
pgsql-general%postgresql.org@interlock.lexmark.com
cc: (bcc: Wesley Sheldahl/Lex/Lexmark)
Subject: Re: [GENERAL] Problems with Blank space

Yes, if you're using fixed-length fields then the value is padded out to the
length that the field is fixed to :-)

I'm sure Perl has some facility for stripping NULLs off of strings, I
suggest using it here or changing the data type in PG...

Good luck!!

I am not sure if this is a database issue or a DBI::Pg issue.

When I do a select * from tablea .... all fields specified as fix length
text field ... return the data with blank space.

Example:
"Eric" returns "Eric****************" where * are blank spaces.

Is this normal?

Eric

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl

#5Christopher Masto
chris-usenet@retardix.com
In reply to: Mitch Vincent (#2)
Re: Problems with Blank space

In article <00f701c11f76$dcd5b6c0$1251000a@Mitch>, "Mitch Vincent"
<mvincent@cablespeed.com> wrote:

Yes, if you're using fixed-length fields then the value is padded out to
the length that the field is fixed to :-)

I'm sure Perl has some facility for stripping NULLs off of strings, I
suggest using it here or changing the data type in PG...

What's wrong with "SELECT TRIM(col) ..."?