public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andrew Dunstan <[email protected]>
To: Laurenz Albe <[email protected]>
To: [email protected]
Subject: Re: Regression in COPY FROM caused by 9f8377f7a2
Date: Mon, 25 Sep 2023 16:52:40 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>


On 2023-09-25 Mo 11:06, Andrew Dunstan wrote:
>
>
> 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.
>
>


Thinking about this a little more, wouldn't it be better if we checked 
at the time we set the default that the value is actually valid for the 
given column? This is only one manifestation of a problem you could run 
into given this table definition.


cheers


andrew

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


view thread (10+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Regression in COPY FROM caused by 9f8377f7a2
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox