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-26 03:16:26
Message-ID: 3D699D8A.6090500@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.

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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Curt Sampson 2002-08-26 04:36:03 Re: how to determine the hardware I need
Previous Message Bruce Momjian 2002-08-25 23:45:49 Re: Backup and Recovery (revisited)