Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 41ED1475BA4 for ; Sun, 25 Aug 2002 23:17:13 -0400 (EDT) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id AB607475896 for ; Sun, 25 Aug 2002 23:17:12 -0400 (EDT) Received: from [192.168.5.2] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1313217; Sun, 25 Aug 2002 20:03:46 -0700 Message-ID: <3D699D8A.6090500@joeconway.com> Date: Sun, 25 Aug 2002 20:16:26 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bhuvan A Cc: pgsql-admin@postgresql.org Subject: Re: Preserving datatypes in dblink. References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/300 X-Sequence-Number: 5414 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