Re: Implicit casts to array types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:39:24
Message-ID: 436.1355499564@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

joshua <jzuellig(at)arbormetrix(dot)com> writes:
> I'm trying to create an implicit cast from an unknown type into a text array
> type by creating a simple array of size 1. e.g.

> create function textarray(unknown)
> returns text[]
> as 'select ARRAY[$1::text];'
> language sql
> immutable;

> create cast (unknown as text[]) with function textarray(unknown) as
> implicit;

No, that isn't gonna work. "unknown" isn't a real type and the parser
doesn't use normal casting rules for it. It's just a placeholder until
the parser can figure out what type an undecorated literal ought to be.

What's your actual problem? (I don't see how this connects to COPY
at all --- COPY never does any type inference, nor any implicit
casting.)

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2012-12-14 15:42:08 Re: Read recover rows
Previous Message Tom Lane 2012-12-14 15:35:01 Re: JDBC to load UTF8@psql to latin1@mysql