Re: Regression in COPY FROM caused by 9f8377f7a2

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Regression in COPY FROM caused by 9f8377f7a2
Дата
Msg-id b815e4b1-8d8c-1822-ddd0-0a3c8b56c768@dunslane.net
обсуждение исходный текст
Ответ на Re: Regression in COPY FROM caused by 9f8377f7a2  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: Regression in COPY FROM caused by 9f8377f7a2
Список pgsql-hackers


On 2023-09-25 Mo 04:59, Laurenz Albe wrote:
On Mon, 2023-09-25 at 09:54 +0200, Laurenz Albe wrote:
In v16 and later, the following fails:

CREATE TABLE boom (t character varying(5) DEFAULT 'a long string');

COPY boom FROM STDIN;
ERROR:  value too long for type character varying(5)

In PostgreSQL v15 and earlier, the COPY statement succeeds.

The error is thrown in BeginCopyFrom in line 1578 (HEAD)

  defexpr = expression_planner(defexpr);

Bisecting shows that the regression was introduced by commit 9f8377f7a2,
which introduced DEFAULT values for COPY FROM.


Oops :-(


I suggest the attached fix, which evaluates default values only if
the DEFAULT option was specified or if the column does not appear in
the column list of COPY.


Patch looks reasonable, haven't tested yet.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

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

Предыдущее
От: jacktby jacktby
Дата:
Сообщение: Why need a lock?
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: Doc: vcregress .bat commands list lacks "taptest"