Re: Implicit casts to array types - Mailing list pgsql-general

From Tom Lane
Subject Re: Implicit casts to array types
Date
Msg-id 436.1355499564@sss.pgh.pa.us
Whole thread Raw
In response to Implicit casts to array types  (joshua <jzuellig@arbormetrix.com>)
Responses Re: Implicit casts to array types  (joshua <jzuellig@arbormetrix.com>)
List pgsql-general
joshua <jzuellig@arbormetrix.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


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: JDBC to load UTF8@psql to latin1@mysql
Next
From: Adrian Klaver
Date:
Subject: Re: Read recover rows