Обсуждение: pg_dump handling of trim()

Поиск
Список
Период
Сортировка

pg_dump handling of trim()

От
Troels Arvin
Дата:
Hello,

In a table, I have:

create table foo(
  ...,
  id_alpha3 character(3) NOT NULL
    CHECK (character_length(trim(both ' ' from id_alpha3)) = 3),
  ...
);

When I do a pg_dump, pg_dump translates it to:

CREATE TABLE foo (
    ...
    id_alpha3 character(3) NOT NULL,
    ...
    CONSTRAINT country_id_alpha3 CHECK ((character_length(btrim((id_alpha3)::text, ' '::text)) = 3)),
);

I.e., use of SQL:1999 standard "TRIM(BOTH somechar FROM ...)" is changed
into use of PostgreSQL-specific BTRIM().

As PostgreSQL seems to strive to be standard compliant, I consider the
above a (minor) bug.

--
Greetings from Troels Arvin, Copenhagen, Denmark