Re: COPY and custom datestyles. Or some other technique?

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: COPY and custom datestyles. Or some other technique?
Date: 2023-03-30 01:50:57
Message-ID: e38d14b4-7868-d42c-ff43-15f704e60e29@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/29/23 18:31, Adrian Klaver wrote:
> On 3/29/23 16:24, Ron wrote:
>> Postgresql 13.10
>>
>> $ psql -h myhost.example.com -X dba \
>>          -c "\copy ${tbl} from '/var/lib/pgsql/Rdb/${tbl}.csv' WITH
>> DELIMITER '|';"
>> ERROR:  date/time field value out of range: "2013061914122501"
>> CONTEXT:  COPY t_id_master, line 1, column update_timestamp:
>> "2013061914122501"
>>
>> The timestamp format generated by a legacy dbms is YYYYMMDDHHmmSSCC (year
>> to centisecond, with no delimiters).
>>
>> Is there any way to convince Postgresql to import these fields?
>
> One option:
>
> 1) Import into staging table as varchar field.

I had thought of that.

It would be really helpful to be able to reposition columns in tables.  That
way, one could:
add the new TIMESTAMP column,
populate it using to_timestamp(),
drop the text column,
reposition the TIMESTAMP column to where it "should" be.

--
Born in Arizona, moved to Babylonia.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message 任重 2023-03-30 01:58:07 Get dead tuples data
Previous Message Ron 2023-03-30 01:44:56 Re: COPY and custom datestyles. Or some other technique?