Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kbq3n-0007ut-HO for pgsql-general@arkaria.postgresql.org; Sun, 08 Nov 2020 19:09:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kbq3m-00088r-Gk for pgsql-general@arkaria.postgresql.org; Sun, 08 Nov 2020 19:09:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kbq3m-00088k-9A for pgsql-general@lists.postgresql.org; Sun, 08 Nov 2020 19:09:06 +0000 Received: from 024-182-127-154.biz.spectrum.com ([24.182.127.154] helo=mail.brookhurstdata.net) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kbq3j-0004ZA-Ew for pgsql-general@lists.postgresql.org; Sun, 08 Nov 2020 19:09:04 +0000 Received: from mail.brookhurstdata.net (mail.brookhurstdata.net [10.1.5.12]) by mail.brookhurstdata.net (Postfix) with ESMTP id 416F088901D for ; Sun, 8 Nov 2020 13:09:02 -0600 (CST) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Sun, 08 Nov 2020 13:09:01 -0600 From: Susan Hurst To: pgsql-general@lists.postgresql.org Subject: Re: Foreign Data Wrapper Handler Organization: Brookhurst Data LLC Reply-To: susan.hurst@brookhurstdata.com Mail-Reply-To: susan.hurst@brookhurstdata.com In-Reply-To: <376c4b35-383d-33bf-d22c-0939e034b455@aklaver.com> References: <376c4b35-383d-33bf-d22c-0939e034b455@aklaver.com> Message-ID: <935b28a237e31f840b24d5e090e09342@mail.brookhurstdata.net> X-Sender: susan.hurst@brookhurstdata.com User-Agent: Roundcube Webmail/RCMAIL_VERSION List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk The first pass thru https://www.postgresql.org/docs/12/fdwhandler.html does not tell me what I think I need to know, but I will digest this more thoroughly. Maybe I need to understand more of the lingo re: foreign data wrappers. I do understand that all fdw names must be unique within a database so if I want to connect to more than one foreign db, I need a different name for each connection. I cannot name each fdw postgres_fdw. I would like to name the fdws something like: dbname_to_foreigndbname. For example, here are 2 possible fdws: create foreign data wrapper stp_to_geo; create foreign data wrapper stp_to_metrics; That syntax creates the fdw and I can create user mappings but I cannot import any foreign schemas into my database. The error message says that there is no handler for the fdw. That's where I'm stuck. BTW, I did try using postgres_fdw as a handler... create foreign data wrapper stp_to_geo handler postgres_fdw; ...but then I got these errors: ERROR: function postgres_fdw() does not exist ERROR: foreign-data wrapper "stp_to_geo" does not exist Looks like I need to study a bit more. Sue --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Susan E Hurst Principal Consultant Brookhurst Data LLC Email: susan.hurst@brookhurstdata.com Mobile: 314-486-3261 On 2020-11-07 14:51, Adrian Klaver wrote: > On 11/7/20 12:44 PM, Susan Hurst wrote: >> Can anyone recommend a good online resource for learning how to set up >> a foreign data wrapper using a custom fdw name?  It seems the trick is >> to use a handler to make it work but so far the search results have >> been elusive for creating a fdw with a successful outcome. > > Have you gone through this?: > > https://www.postgresql.org/docs/12/fdwhandler.html > > Also can we get a definition of 'custom fdw name'? > > >> >> I'm using 'PostgreSQL 11.8 on amd64-portbld-freebsd12.1, compiled by >> FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on >> LLVM 8.0.1), 64-bit' >> >> Thanks for your help! >> >> Sue >>