Re: Preserving datatypes in dblink.

From: Joe Conway <mail(at)joeconway(dot)com>
To: Bhuvan A <bhuvansql(at)linuxfreemail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Preserving datatypes in dblink.
Date: 2002-08-27 00:59:46
Message-ID: 3D6ACF02.4030306@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Vilson farias 2002-08-27 12:36:24 Re: Deleting large amount of data.
Previous Message Alvaro Herrera 2002-08-26 21:07:59 Re: [GENERAL] MSAcess databasse type X PostgreSQL database type