On Mar 2, 2012, at 12:58 PM, <david.sahag...@emc.com> wrote:

> Can anybody please point me to where this "difference of behavior" is 
> explained/documented ?
> Thanks,
> -dvs-
> 
> -- version = 9.1.3
> do $$
> declare
>  v_str  char(10);
> begin
>  v_str := 'abc' ;
>  raise info '%', concat(v_str, v_str) ;
>  raise info '%', v_str||v_str ;
> end
> $$;
> 
> INFO:  abc       abc
> INFO:  abcabc

I'm not sure why || works differently than concat(), but char() is 
whitespace-padded. You told the db you wanted "10 characters", so that's what 
it gave you. Perhaps you wanted vchar(10)? For that matter, do you even want 
that restriction of 10 characters in the first place? Perhaps the type text is 
what you're really after?


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to