From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: COPY and custom datestyles. Or some other technique?
Date: Wed, 29 Mar 2023 21:38:53 -0500
Message-ID: <9c9380da-dcf9-7159-a59e-ecc50d34b30c@gmail.com> (raw)
In-Reply-To: <CAKFQuwbXWkWOZFTe1wDiQu21uH+_rp=BqHmBhBN35+o7L+VDDA@mail.gmail.com>
References: <c1b6aa5b-61ca-1ab6-6295-172fbc0f6c21@gmail.com>
<9aa715ce-9485-638f-6567-e642a50699c4@aklaver.com>
<e38d14b4-7868-d42c-ff43-15f704e60e29@gmail.com>
<CAKFQuwbXWkWOZFTe1wDiQu21uH+_rp=BqHmBhBN35+o7L+VDDA@mail.gmail.com>
On 3/29/23 21:06, David G. Johnston wrote:
> On Wed, Mar 29, 2023 at 6:51 PM Ron <ronljohnsonjr@gmail.com> wrote:
>
> 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.
>
>
> If that would give you what you need then just define the column as text
> initially, load the data, then do an ALTER COLUMN ... ALTER TYPE to change
> the column type to timestamptz in place, with the conversion done via USING.
>
> David J.
>
Something like this?
ALTER TABLE foo
ALTER COLUMN update_ts TIMESTAMP WITHOUT TIME ZONE
USING to_timestamp(update_ts, 'YYYYMMDDHH24miSSMS');
That would definitely minimize the possibility of errors.
--
Born in Arizona, moved to Babylonia.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ronljohnsonjr@gmail.com
Subject: Re: COPY and custom datestyles. Or some other technique?
In-Reply-To: <9c9380da-dcf9-7159-a59e-ecc50d34b30c@gmail.com>
References: <c1b6aa5b-61ca-1ab6-6295-172fbc0f6c21@gmail.com> <9aa715ce-9485-638f-6567-e642a50699c4@aklaver.com> <e38d14b4-7868-d42c-ff43-15f704e60e29@gmail.com> <CAKFQuwbXWkWOZFTe1wDiQu21uH+_rp=BqHmBhBN35+o7L+VDDA@mail.gmail.com> <9c9380da-dcf9-7159-a59e-ecc50d34b30c@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox