0

PostgreSQL 在哪里存储在选择期间从外部表中丢弃的记录?我有下表:

CREATE FOREIGN TABLE ext.alternatenamesext (
  altid BIGINT,
  geoid BIGINT,
  isolanguage VARCHAR(7),
  alternatename TEXT,
  ispreferredname INTEGER,
  isshortname INTEGER,
  iscolloquial INTEGER,
  ishistoric INTEGER
) 
SERVER edrive_server
OPTIONS (
  delimiter E'\t',
  encoding 'UTF-8',
  filename '/mnt/storage/edrive/data/alternateNames.txt',
  format 'csv');

alternateNames.txt 包含约 1100 万条记录。但是当我执行“SELECT * FROM ext.alternatenamesext”时,它只返回约 950 万条记录。剩下的 200 万在哪里?有没有办法将它们放入单独的文件中,例如 Oracle 的 sql*ldr?

4

1 回答 1

0

问题已通过 CREATE FOREIGN TABLE... 的以下语法解决:

CREATE FOREIGN TABLE ext.alternatenamesext (
  altid BIGINT,
  geoid BIGINT,
  isolanguage VARCHAR(7),
  alternatename VARCHAR(400),
  isPreferredName INT,
  isShortName INT,
  isColloquial INT,
  isHistoric INT
)
SERVER edrive_server
OPTIONS (
  delimiter E'\t',
  encoding 'UTF-8',
  filename '/mnt/storage/edrive/data/alternateNames.txt',
  format 'text',  -- not 'csv'!
  null '');  -- eliminate null values (some kind of TRAILING NULLCOLLS in Oracle I guess)
于 2016-06-15T19:20:29.113 回答