From: | Stefan Knecht <knecht(dot)stefan(at)gmail(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Rama Krishnan <raghuldrag(at)gmail(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Value Too long varchar(100) |
Date: | 2022-10-27 12:48:37 |
Message-ID: | CAP50yQ8xkf7mWHUhXRcPoSQYFa5eojR9bgmfhMebCCUF7NtvQA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
You should be able to do something with this if you require it to be done
with COPY:
https://paquier.xyz/postgresql-2/postgres-9-3-feature-highlight-copy-tofrom-program/
But, as David suggested, I'd also recommend to do an intermediate step, and
load the data into a table, or pre-process the file to be how you want it.
On Thu, Oct 27, 2022 at 7:19 PM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
>
> On Thu, Oct 27, 2022 at 5:02 AM Rama Krishnan <raghuldrag(at)gmail(dot)com>
> wrote:
>
>> Hi team,
>>
>> We are getting csv file from client to upload data in my db table , one
>> particular column I. E clinet description column contains more than 100
>> character hence I am getting value too long varchar (100) so we decided to
>> upload db only first 100 characters. How to use this thing in copy command
>>
>
> You cannot. Either fix the content of the file or remove the arbitrary
> length limitation on the field (i.e., change the type to "text"). I
> suggest the later. You may also,copy into a temporary staging table that
> lacks the limit, then use insert to move the transformed data (via a select
> query) into the production table.
>
> David J.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Mizzi | 2022-10-27 13:28:14 | EXPLAIN ANALYZE does not return accurate execution times |
Previous Message | David G. Johnston | 2022-10-27 12:18:40 | Re: Value Too long varchar(100) |