Skip to content

ogr generating duplicate column names when column names truncated because of 63 character limit #269

@robe2

Description

@robe2

So it's odd this is the first time I'm running into it. But I have a CSV file that has headers as long as 84 characters, and when they are shrunk to the 63 character limit allowed for identifiers -- as noted on this page - https://www.postgresql.org/docs/current/limits.html some of the columns get truncated to the same name and thus can't be loaded. It yields the same error as what you get with #252 but I assume this is fixable.

CREATE SERVER svr_csv_test
    FOREIGN DATA WRAPPER ogr_fdw
    OPTIONS (datasource '/fdw_data/csvs', format 'CSV');

IMPORT FOREIGN SCHEMA ogr_all LIMIT TO (test) FROM SERVER svr_csv_test INTO staging;

Get error if I have the attached file in the folder

test.csv

NOTICE:  Number of tables to be created 1
ERROR:  column "this_column_name_is_very_very_long_aaaaaaaaaaaaaaaaaaaaaaaaaaaa" specified more than once
CONTEXT:  importing foreign table "test" 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions