file-fdw and force_null

Boshomi Phenix <boshomi@gmail.com>

From: Boshomi Phenix <boshomi@gmail.com>
To: pgsql-docs@lists.postgresql.org
Date: 2023-09-11T14:28:50Z
Lists: pgsql-docs
Hello Friends

I tried to create a file-fdw foreign table with force_null for some columns.
FORCE_NULL syntax differs from COPY. For me it was not clear that the
"OPTIONS" keyword by the column was necessary, so it would be nice to add
this to the example.


DROP FOREIGN TABLE IF EXISTS testforcenull;
CREATE FOREIGN TABLE testforcenull
( cola text NOT NULL,
  colb text,
  colc text OPTIONS(FORCE_NULL 'true')
  ) SERVER bevcsv
    OPTIONS (filename '~/testforcenull.csv',
       FORMAT 'csv',
       HEADER 'true',
       DELIMITER ';',
       QUOTE '"'
       );

best regards

Commits

  1. doc: Add example for how to set file_fdw column option