Re: String concatenation operator which keeps trailing spaces in CHAR(n) columns

Поиск
Список
Период
Сортировка
От Andrus
Тема Re: String concatenation operator which keeps trailing spaces in CHAR(n) columns
Дата
Msg-id 989A8C97FBD34193801F2E1B7F2AB744@dell2
обсуждение исходный текст
Ответ на Re: String concatenation operator which keeps trailing spaces in CHAR(n) columns  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Ответы Re: String concatenation operator which keeps trailing spaces in CHAR(n) columns
Список pgsql-general
Hi!

>Use "bpchar" instead of "text" in the definition of function and operator.
>Otherwise col1 gets cast to "text" and loses its trailing spaces.

Thank you very much.
It worked.
Which notation to use for this ?

Is it reasonable use "+" as such operator for strings or should some other
notation used ?

I tried:

CREATE OR REPLACE FUNCTION public.concatkeepspaces(left bpchar, right
bpchar)
RETURNS bpchar
LANGUAGE sql IMMUTABLE
AS $BODY$
SELECT concat($1,$2);
$BODY$;

CREATE OPERATOR public.+ (
    leftarg = bpchar,
    rightarg = bpchar,
    procedure = public.concatkeepspaces
);

Andrus.



В списке pgsql-general по дате отправления:

Предыдущее
От: Albe Laurenz
Дата:
Сообщение: Re: String concatenation operator which keeps trailing spaces in CHAR(n) columns
Следующее
От: Albe Laurenz
Дата:
Сообщение: Re: String concatenation operator which keeps trailing spaces in CHAR(n) columns