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: Sun, 25 Aug 2002 20:16:26 -0700
Message-ID: <3D699D8A.6090500@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.

Hmmm. I see what you mean. I'm afraid there may be no way to return an 
array via dblink currently :(

I am just starting the next upgrade to dblink to support table functions 
in PostgreSQL 7.3 (which starts beta testing around September 1). Table 
functions should make dblink work much more naturally, something like 
(not yet working, but hopefully should be by next weekend on 7.3devel):

select
  d.f1, d.f2
from
  dblink('dbname=mydb', 'select f1, f2 from remotetbl')
  as d(f1 int, f2 text);

This would return f1 as an int, and f2 as text without the need to cast 
them in the target list. I would think that arrays would return fine 
this way, but I'll check as I'm working on it.

Joe




view thread (7+ messages)  latest in thread

Message-ID: <3D699D8A.6090500@joeconway.com>
Permalink:  ../3D699D8A.6090500@joeconway.com/
Also on:    postgresql.org/message-id/3D699D8A.6090500@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: <3D699D8A.6090500@joeconway.com>
  References: <Pine.LNX.4.44.0208241035200.1799-100000@Bhuvan.bksys.co.in> <3D699D8A.6090500@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