PostgreSQL:外部 table 和丢弃的记录
PostgreSQL: foreign table and discarded records
PostgreSQL 在哪里存储在 select 期间从外部 table 丢弃的记录?我有以下 table:
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" 它 returns 只有 ~950 万条记录。剩下的200万在哪里?有没有办法把它们放到单独的文件中,就像 Oracle 的 sql*ldr?
问题已通过以下语法 CREATE FOREIGN TABLE...:[=11=] 解决
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)
PostgreSQL 在哪里存储在 select 期间从外部 table 丢弃的记录?我有以下 table:
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" 它 returns 只有 ~950 万条记录。剩下的200万在哪里?有没有办法把它们放到单独的文件中,就像 Oracle 的 sql*ldr?
问题已通过以下语法 CREATE FOREIGN TABLE...:[=11=] 解决
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)