From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | joshua <jzuellig(at)arbormetrix(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Implicit casts to array types |
Date: | 2012-12-14 15:43:41 |
Message-ID: | CAHyXU0xyj4QC=ZpHKoJ1t1q94jLM9jp=tnEoUwLMCH7M7PPcvA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Dec 14, 2012 at 9:32 AM, joshua <jzuellig(at)arbormetrix(dot)com> wrote:
> Thanks, that function does help, but it still cannot cast directly to text[];
> The point of the functions was only ever to allow for an implicit cast to
> text[];
I'm not parsing that. Why do you need an explicit cast?
> My goal is to be able to copy from a simple csv with nonarray entries
> ("1,2,3,...") and extract text arrays when the target table calls for it by
> creating an array of size 1. I believe this will require a custom implicit
> cast from unknown to text[], but if there's a better way to do it, I'd love
> to know.
If I want to handle csv data in an array, I usually do it like this:
*) create a one column table for staging the load
*) COPY the data to that table, intentionally faking the delimiter
*) process via conversion to array with 'string_to_array'.
the above only works if there's no commas inside your strings, so a
little extra massaging might be required in that case.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2012-12-14 15:44:29 | Re: JDBC to load UTF8@psql to latin1@mysql |
Previous Message | Adrian Klaver | 2012-12-14 15:42:08 | Re: Read recover rows |