pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Bhuvan A <bhuvansql@linuxfreemail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Preserving datatypes in dblink.
Date: Mon, 26 Aug 2002 17:59:46 -0700
Message-ID: <3D6ACF02.4030306@joeconway.com> (raw)
References: <Pine.LNX.4.44.0208241035200.1799-100000@Bhuvan.bksys.co.in>

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




view thread (7+ messages)

Message-ID: <3D6ACF02.4030306@joeconway.com>
Permalink:  ../3D6ACF02.4030306@joeconway.com/
Also on:    postgresql.org/message-id/3D6ACF02.4030306@joeconway.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mail@joeconway.com, bhuvansql@linuxfreemail.com
  Subject: Re: Preserving datatypes in dblink.
  In-Reply-To: <3D6ACF02.4030306@joeconway.com>
  References: <Pine.LNX.4.44.0208241035200.1799-100000@Bhuvan.bksys.co.in> <3D6ACF02.4030306@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox