Subject: create foreign table

From: Sam Stearns <[email-masked]>
Date: Mon, 14 Oct 2024 11:14:05 -0700

Howdy,

Receiving an error without much detail when creating a foreign table:

2024-10-14 11:08:30.928 PDT [1177724] ERROR:  conflicting or redundant
options
2024-10-14 11:08:30.928 PDT [1177724] STATEMENT:  CREATE FOREIGN  TABLE
ext_invalids (
                validcargo char(8),
                validauto char(8),
                cllocid char(8),
                insdid char(6),
                memberid char(14),
                attachdate char(12),
                commonauthority char(1),
                contractauthority char(1),
                compname char(60),
                docket_num char(9)
        ) SERVER external_dat_dir OPTIONS(filename 'DISABLED', format
'csv', delimiter ',', program '');

I'm not seeing much out there on the error.  I'm also not seeing what are
valid values for the OPTIONS keyword in the Postgres documentation.

Would someone be able to give advice here, please?

Thanks,

Sam

-- 

*Samuel Stearns*
Lead Database Administrator
*c:* 971 762 6879 | *o:* 503 672 5115 | DAT.com
<https://www.dat.com/?utm_medium=email&utm_source=DAT_email_signature_link>

---

From: Guillaume Lelarge <[email-masked]>
Date: Mon, 14 Oct 2024 20:18:26 +0200

Hi,

> Would someone be able to give advice here, please?
Saying which FDW you're using would help, but I guess it's file_fdw.

You can't specify both filename and program. You have to choose one of them.

Regards.

-- 
Guillaume.

---

From: Sam Stearns <[email-masked]>
Date: Mon, 14 Oct 2024 11:57:04 -0700

That did the trick.  Thank you!

Sam

-- 

*Samuel Stearns*

---

From: vignesh kumar <[email-masked]>
Date: Tue, 15 Oct 2024 16:00:26 +0000

First you need to create foreign server, foreign data wrapper then followed by granting access to use the postgres_fdw.. then try accessing it.. that's the optimal way.. I'm not getting what is being tried here

Sent from Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Guillaume Lelarge <[email-masked]>
Sent: Monday, October 14, 2024 11:48:26 PM
To: Sam Stearns <[email-masked]>
Cc: Pgsql-admin <[email-masked]>
Subject: Re: create foreign table

Hi,

Le lun. 14 oct. 2024 à 20:14, Sam Stearns <[email-masked]<mailto:[email-masked]>> a écrit :
Howdy,

2024-10-14 11:08:30.928 PDT [1177724] ERROR:  conflicting or redundant options
2024-10-14 11:08:30.928 PDT [1177724] STATEMENT:  CREATE FOREIGN  TABLE ext_invalids (
                validcargo char(8),
                validauto char(8),
                cllocid char(8),
                insdid char(6),
                memberid char(14),
                attachdate char(12),
                commonauthority char(1),
                contractauthority char(1),
                compname char(60),
                docket_num char(9)
        ) SERVER external_dat_dir OPTIONS(filename 'DISABLED', format 'csv', delimiter ',', program '');

I'm not seeing much out there on the error.  I'm also not seeing what are valid values for the OPTIONS keyword in the Postgres documentation.

Regards.

--
Guillaume.

---

From: Sam Stearns <[email-masked]>
Date: Tue, 15 Oct 2024 09:39:39 -0700

I removed 'program' from the OPTIONS keyword which resolved it, as
suggested by Guillaume.

On Tue, Oct 15, 2024 at 9:00 AM vignesh kumar <
[email-masked]> wrote:

> First you need to create foreign server, foreign data wrapper then
> followed by granting access to use the postgres_fdw.. then try accessing
> it.. that's the optimal way.. I'm not getting what is being tried here
>
> Sent from Outlook for Android <https://aka.ms/AAb9ysg>
> ------------------------------
> *From:* Guillaume Lelarge <[email-masked]>
> *Sent:* Monday, October 14, 2024 11:48:26 PM
> *To:* Sam Stearns <[email-masked]>
> *Cc:* Pgsql-admin <[email-masked]>
> *Subject:* Re: create foreign table
>
> Hi,
>

-- 

*Samuel Stearns*

---

From: vignesh kumar <[email-masked]>
Date: Tue, 15 Oct 2024 16:54:01 +0000

Great and glad it worked for you.. it's always better to cache the foreign server details onto postgres wrappers.. so that your calls to foreign objects would be simpler and more secure..

Sent from Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Sam Stearns <[email-masked]>
Sent: Tuesday, October 15, 2024 10:09:39 PM
To: vignesh kumar <[email-masked]>
Cc: Guillaume Lelarge <[email-masked]>; Pgsql-admin <[email-masked]>
Subject: Re: create foreign table

I removed 'program' from the OPTIONS keyword which resolved it, as suggested by Guillaume.

On Tue, Oct 15, 2024 at 9:00 AM vignesh kumar <[email-masked]<mailto:[email-masked]>> wrote:
First you need to create foreign server, foreign data wrapper then followed by granting access to use the postgres_fdw.. then try accessing it.. that's the optimal way.. I'm not getting what is being tried here

Sent from Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Guillaume Lelarge <[email-masked]<mailto:[email-masked]>>
Sent: Monday, October 14, 2024 11:48:26 PM
To: Sam Stearns <[email-masked]<mailto:[email-masked]>>
Cc: Pgsql-admin <[email-masked]<mailto:[email-masked]>>
Subject: Re: create foreign table

Hi,

Regards.

--
Guillaume.

--

Samuel Stearns
Lead Database Administrator
c: 971 762 6879 | o: 503 672 5115 | DAT.com

[DAT]<https://www.dat.com/?utm_medium=email&utm_source=DAT_email_signature_link>

---

From: Sam Stearns <[email-masked]>
Date: Tue, 15 Oct 2024 10:12:28 -0700

Thanks,Vignesh!

On Tue, Oct 15, 2024 at 9:54 AM vignesh kumar <
[email-masked]> wrote:

> Great and glad it worked for you.. it's always better to cache the foreign
> server details onto postgres wrappers.. so that your calls to foreign
> objects would be simpler and more secure..
>
> *From:* Sam Stearns <[email-masked]>
> *Sent:* Tuesday, October 15, 2024 10:09:39 PM
> *To:* vignesh kumar <[email-masked]>
> *Cc:* Guillaume Lelarge <[email-masked]>; Pgsql-admin <
> [email-masked]>

-- 

*Samuel Stearns*