Re: Preserving datatypes in dblink. - Mailing list pgsql-admin

From Joe Conway
Subject Re: Preserving datatypes in dblink.
Date
Msg-id 3D6ACF02.4030306@joeconway.com
Whole thread Raw
In response to Re: Preserving datatypes in dblink.  (Bhuvan A <bhuvansql@linuxfreemail.com>)
List pgsql-admin
Bhuvan A wrote:
> Yeah, I did try the same earlier but it says
> ERROR:  Cannot cast type 'text' to 'text[]'
>
> So how do we cast text to text[](_text)? Is there any alternate way?
> Awaiting for your valuable suggestion again, please.

Just as an FYI -- as of a few minutes ago, I've gotten the following to
work:

test3=# create table foo(f1 text[]);
CREATE TABLE
test3=# insert into foo values('{a,b,c,d}');
INSERT 250715 1
test3=# insert into foo values('{e,f,g,h}');
INSERT 250716 1
test3=# \c test
You are now connected to database test.
test=# select * from dblink('dbname=test3','select f1 from foo') as t(f1
text[]);
     f1
-----------
  {a,b,c,d}
  {e,f,g,h}
(2 rows)

test=# select f1[1] from dblink('dbname=test3','select f1 from foo') as
t(f1 text[]);
  f1
----
  a
  e
(2 rows)

So, although I can't help you in 7.2.x, it looks like dblink will do
what you need in PostgreSQL 7.3 (which starts beta in a few days).

HTH,

Joe


pgsql-admin by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Deleting large amount of data.
Next
From: "Vilson farias"
Date:
Subject: Re: Deleting large amount of data.